We are currently performing maintenance on Appian Community. As a result, discussions posts and replies are temporarily unavailable. We appreciate your patience.

How should I first generate, then download the document by clicking the link that starts this process?

Hello, I have the following code that calls an integration and it returns a file which saves in the file local variable.

I must be able to click the same link then generate and download the file stored in local!file

integration:

a!localVariables(
  local!file,
  a!richTextDisplayField(
    value: a!richTextItem(
      text: "Download Document",
      link: a!dynamicLink(
        saveInto: {
          rule!ADC_Gerar_Relatorio_Campanha(
            idCampanha: "2C918D8783461A630184BEC5E4453392",
            onSuccess: { a!save(local!file, fv!result.body),
            
             
            },
            onError: {}
          )
        }
      )
    )
  )
)

What solution would you recommend me? I have tried through an WebAPI as well:

a!localVariables(
  local!relatorioCampanha,
  local!docId: rule!ADC_Gerar_Relatorio_Campanha(
    idCampanha: http!request.queryParameters.cid,
    onSuccess: {
      a!save(local!relatorioCampanha, fv!result),
    },
    onError: {}
  ),
  a!httpResponse(
    headers: a!httpHeader(
      name: "Content-Disposition",
      value: concat("attachment")
    ),
    /*body: local!document,*/
    body: local!relatorioCampanha.body
    
  )
)

the I call the webAPI above through a safe link, but it is not working properly.

Thanks in advance

  Discussion posts and replies are publicly visible