Link to download a document in a editable grid.

Hi,

I have below code in one of the column of a gridLayout control. I am getting an error like

Could not display interface. Please check definition and inputs. Interface Definition: Expression evaluation error at function a!forEach [line 24]: Error in a!forEach() expression during iteration 1: Expression evaluation error at function 'document' [line 59]: Document Does Not Exist or has been Deleted. 

I have highlighted the error line in the below code.

a!linkField(
label: "Download document",
labelPosition: "ABOVE",
links: {
a!documentDownloadLink(
label: if(
isnull(fv!item.document),
"",
document( fv!item.document, "name")
) & if(isnull(fv!item.document), "", ".") & if(
isnull( fv!item.document),
"",
document(fv!item.document, "extension")
),
document: fv!item.document
)
}
)

  Discussion posts and replies are publicly visible

Parents
  • When and how is the document in question being uploaded?

    Further, are there any rows with an empty "document" entry?  If so, you'll need to handle nulls.  My recommendation is to not use a!linkfield() for any reason in any location (including but not limited to editable grids), instead you should always use Rich Text Fields with a built-in link, where you control the link to be visible only when the conditions are correct (in this case, a document exists and has already been submitted into the filesystem).

  • I am getting same kind of issue even with the below code after using richTextDisplayField, documentDownloadLink:

    a!richTextDisplayField(
    value: a!richTextItem(
    link: a!documentDownloadLink(
    showWhen: a!isNotNullOrEmpty(fv!item.document),
    label: if(
    a!isNullOrEmpty( fv!item.document),
    "",
    document(fv!item.document, "name")
    ) & if(a!isNullOrEmpty( fv!item.document), "", ".") & if(
    a!isNullOrEmpty( fv!item.document),
    "",
    document( fv!item.document, "extension")
    ),
    document: fv!item.document
    )
    )
    ),

  • 0
    Certified Associate Developer
    in reply to swapnar6405

    Hi  ,
    One doubt,
    Are you trying to upload the document in the same editable grid in one column and trying to download the same document in the documemtdownloadlink in another column?

    If you are doing that, you will get the same error "Document Does Not Exist or has been Deleted." because the document you uploaded it was not entered into filesystem. 

  • 0
    Certified Lead Developer
    in reply to swapnar6405

    Like Teja said, a document is only considered uploaded when you submit the interface or you use thesubmitUploadedFiles() function. So if you have the file upload field in the same grid, then the download icon won't make sense anyway because the user just uploaded the document so why do they need to download it immediately? 

Reply Children
No Data