Skip to main content
ankitt714102
June 8, 2021
Question

Disable document download link field in Read Only grid

  • June 8, 2021
  • 4 replies
  • 0 views

Hi, 

I want to disable document link from read only grid if document is not exists or deleted from document folder.I am using following code to show and download document from read only grid.

a!gridColumn(
label: "File Name",
value:
a!linkField(
links: a!documentDownloadLink(
label: index(fv!row, "myFileName", {}),
document: index(fv!row, "appianDocId", {})
)
)
)

Please Suggest me any solution for this.

    4 replies

    stefanhelzle0001
    Brainy
    June 8, 2021

    Add a showWhen to the link with a check like: "not(isnull(index(fv!row, "appianDocId", {})))"

    ankitt714102
    June 8, 2021

    Thanks. But we are not deleting appianDocId from our db it will be exists all time in our db, but after one week the document will be automatically deleted from Appian Document folder.On that time we have a requirement that all those document which are not existed on Document folder those link will also disabled from grid.

    stefanhelzle0001
    Brainy
    June 8, 2021

    The plugin content tools has a function getcontentobjectsdetailsbyid. That is at least one option. Why do you not update DB when deleting the documents?

    mikes0011
    Brainy
    June 8, 2021

    For the past several years at least, I have strongly recommended that developers not use a!linkField() ... for anything, really.  Instead, use a!richTextDisplayField() which includes far more functionality and flexibility.  Within a!richTextItem, you can dynamically set a link with a showWhen parameter, and control what the text says (and its formatting) for different scenarios.  Pair this with functionality to check whether the doc ID is still valid (though I share Stefan's concern that you're deleting documents without updating the Database).

    I forget (off the top of my head) whether there's an OOB function to check document existence based on ID, but one available plug-in is "Check Object Existence" which contains one simple rule that you pass an ID to and it returns TRUE or FALSE.

    The Expression Guru