On Single Click Download The Document and Write record in DB

Hi Everyone,

Is there any way to Download the document and Write operation into Data Base on One Link[One Click Event] from User Interface level.

We are working on 18.2.

Thanks In Advance!!

  Discussion posts and replies are publicly visible

Parents Reply
  • 0
    Certified Lead Developer
    in reply to Venkatesh Suram

    Below is the screenshot. So in below scenario When user clicks on 'Generate Export File' Button , we save the button action  in process variable and submit the form. once submitted base on the button action we have some database write logic and some document generation code . once the document is generated reloop to the same form and show the link to generated document using a!linkField

Children
  • Thanks For The response  

    In My scenario no need to generate a new document , I have already document . When user clicks on the link he should able to  download and write the operation into data base.

    In my use case instead of looping the same form we can work with link field, Please find below sample code.

    load(
      local!isShowDocument:false(),
    {
      a!linkField(
        label: "",
        labelPosition: "ABOVE",
        links: {
          a!dynamicLink(
            label:"Show Document",
            value:true(),
            saveInto: {
             local!isShowDocument,
            /*We can perform the Write Operation here*/
           /* a!writeToDataStoreEntity(
              
            )*/
            },
            showWhen:not(local!isShowDocument)
          ),
          a!documentDownloadLink(
            label:"Download Document",
            document:todocument(12345),
            showWhen:local!isShowDocument
          )
        }
      )
    }
    )

    Same thing suggested by Shanmukha (raghavendrar0001), But here we need to assume once user clicks on the show Document label downloaded the document irrespective of the download action.