Hi , I am building a document upload form after uploading the document it should be populating in the gridfield with the link format where user can download the lfile. but that field is coming as empty. This is my code. The documentId field is text now, we don't have access to edit it now . can changing the datatype will fix the issue or is there anything elseI have to look into?
a!localVariables( local!documentId: null, local!category: null, local!comment: null, local!showUploadSection: false(), local!npdoDocumentList: ri!npdoDocument, a!formLayout( contents: { a!sectionLayout( contents: { a!boxLayout( label: "Supporting Documents", contents: { a!gridField( data: local!npdoDocumentList, columns: { a!gridColumn( label: "Title", value: a!linkField( label: fv!row['recordType!{a1b2b5cb-c59b-4595-aff1-2d50b50e490a}NPDO Document.fields.{0c0ce663-8d05-43a5-9c23-92394e8102ec}documentId'], links: a!documentDownloadLink( document: tointeger(fv!row['recordType!{a1b2b5cb-c59b-4595-aff1-2d50b50e490a}NPDO Document.fields.{0c0ce663-8d05-43a5-9c23-92394e8102ec}documentId']) ) ) ), a!gridColumn( label: "Category", value: fv!row['recordType!{a1b2b5cb-c59b-4595-aff1-2d50b50e490a}NPDO Document.fields.{408a7879-6ab6-45cb-a35e-7330c9caf15e}category'] ), a!gridColumn( label: "Comments", value: fv!row['recordType!{a1b2b5cb-c59b-4595-aff1-2d50b50e490a}NPDO Document.fields.{dfc46fd3-86fc-4d85-b663-544b3b9d1031}comment'] ), a!gridColumn( label: "Uploaded On", value: fv!row['recordType!{a1b2b5cb-c59b-4595-aff1-2d50b50e490a}NPDO Document.fields.{7481670c-f621-4872-bd46-d6d20909e139}uploadedOn'] ), a!gridColumn( label: "Uploaded By", value: fv!row['recordType!{a1b2b5cb-c59b-4595-aff1-2d50b50e490a}NPDO Document.fields.{3ad4e016-cf0f-4bf3-8231-ef8cbf9bed92}uploadedBy'] ), } ) }, style: "INFO", labelSize: "MEDIUM" ) } ), a!sectionLayout( contents: { a!buttonLayout( primaryButtons: { a!buttonWidget( label: "Upload Docs", submit: false, style: "SOLID", icon: "file-upload", saveInto: a!save(local!showUploadSection, true()), showWhen: not(local!showUploadSection) ) } ) } ), a!sectionLayout( contents: { a!boxLayout( label: "Upload Document", contents: { a!fileUploadField( label: "Choose a file", required: true, target: cons!NPDO_REQUEST_DOCUMENTS_FOLDER, maxSelections: 1, value: local!documentId, labelPosition: "ADJACENT", saveInto: local!documentId ), a!dropdownField( choiceLabels: { "New Request", "Miscellaneous" }, choiceValues: { "New Request", "Miscellaneous" }, label: "Category", required: true, labelPosition: "ADJACENT", placeholder: "Document category", value: local!category, saveInto: local!category ), a!paragraphField( label: "Comments", labelPosition: "ADJACENT", required: true, value: local!comment, saveInto: local!comment ) } ) }, showWhen: local!showUploadSection ) }, buttons: a!buttonLayout( primaryButtons: { a!buttonWidget( label: "Submit", submit: true, style: "SOLID", saveInto: { a!save( local!npdoDocumentList, append( local!npdoDocumentList, 'recordType!{a1b2b5cb-c59b-4595-aff1-2d50b50e490a}NPDO Document'( 'recordType!{a1b2b5cb-c59b-4595-aff1-2d50b50e490a}NPDO Document.fields.{0c0ce663-8d05-43a5-9c23-92394e8102ec}documentId': local!documentId, 'recordType!{a1b2b5cb-c59b-4595-aff1-2d50b50e490a}NPDO Document.fields.{408a7879-6ab6-45cb-a35e-7330c9caf15e}category': local!category, 'recordType!{a1b2b5cb-c59b-4595-aff1-2d50b50e490a}NPDO Document.fields.{dfc46fd3-86fc-4d85-b663-544b3b9d1031}comment': local!comment, 'recordType!{a1b2b5cb-c59b-4595-aff1-2d50b50e490a}NPDO Document.fields.{13c5c9df-b703-4040-baf4-64a65ffc62f3}uploadedBySOEID': loggedInUser(), 'recordType!{a1b2b5cb-c59b-4595-aff1-2d50b50e490a}NPDO Document.fields.{7481670c-f621-4872-bd46-d6d20909e139}uploadedOn': now(), 'recordType!{a1b2b5cb-c59b-4595-aff1-2d50b50e490a}NPDO Document.fields.{041e09bf-8b95-4f82-87c6-6289b8c22b57}isActive': 1, 'recordType!{a1b2b5cb-c59b-4595-aff1-2d50b50e490a}NPDO Document.fields.{3ad4e016-cf0f-4bf3-8231-ef8cbf9bed92}uploadedBy': concat(user(loggedInUser(), "firstName")," ",user(loggedInUser(), "lastName")) ) ) ), a!save(ri!npdoDocument,local!npdoDocumentList), a!save(local!documentId, null), a!save(local!category, null), a!save(local!comment, null), a!save(local!showUploadSection, false()) } ) }, secondaryButtons: { a!buttonWidget( label: "Cancel", submit: false, style: "OUTLINE", validate: false, saveInto: { a!save(local!documentId, null), a!save(local!category, null), a!save(local!comment, null), a!save(local!showUploadSection, false()) } ) }, showWhen: local!showUploadSection ) ) )
Discussion posts and replies are publicly visible
Can you clarify - you mentioned the DocumentId field is typed as text currently, but when you try it, is it actually being populated with any value? What happens between when the user uploads the new document and the download link is supposed to show up in the grid? FWIW, i believe even now still a form will need to be submitted before a newly-uploaded file is available to be targeted by a Document Download Link (this has changed slightly in the 2025 versions, but certainly not in 24.2).
When the user upload the file in the documentId field value is populated in both local and on submit ruleinput With this format "Document -some integer" , Document:223445. But this is not being populated in the grid.
If you set the column to plaintext, what shows up then?
BTW, just for design flexibility, I recommend you make the column use the RichTextDisplayField component to handle showing anything you want as far as links - it allows mixed plaintext and links including formatting (with icons) as well as not showing a link in some cases (for example rows with no document ID present), which is not possible with the plain LinkField component (which i recommend against using in basically any case, since we have the RichTextDisplayField).