How to display the attachments stored in a folder in interface.

Hi everyone,

I have the requirement to display the attachments stored in a folder, whose unique names are present in database. I would like to provide a link to user in such a way that the name is displayed in the interface and when user clicks over it, the attachment gets downloaded.

Thank You.

  Discussion posts and replies are publicly visible

Parents Reply Children
  • 0
    Certified Senior Developer
    in reply to shubhamy0001

    you can use Mikes suggestion above. Its pretty clean and well structured.
    But you will need one adjustment: 
    Search in your DB for the suitable data which includes your DocumentId not a folder content. 



    a!localVariables(
      
      local!documentIds: rule!APP_QR_queryEntityRuleWhichGetYourDocumentIds(),
      a!boxLayout(
        label: "Documents",
        contents: {
          a!richTextDisplayField(
            value: {
              a!forEach(
                local!documents,
                {
                  a!richTextItem(
                    text: {
                      a!richTextIcon(icon: "file-o"),
                      " ",
                      document(fv!item, "name"),
                      ".",
                      document(fv!item, "extension")
                    },
                    link: a!documentDownloadLink(
                      document: fv!item
                    )
                  ),
                  char(10)
                }
              )
            }
          )
        }
      )
    )

    Second idea: you can store a folder Id and look for folder content. For this case Mikes solution is perfect, if you load the folderId in your process and fill the input of the user input task with the loaded pv!-value for ri!folder