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
This is my integration response
this is where i get its response, and expect to download as well
Generally this is only easily accomplished via a 2-click approach - the first click fires off integration call which saves the generated doc ID into a local variable, and then your interface provides a download link (via a!documentDownloadLink()) after the ID is populated.
what if I want to generate the document when the page loads and then use the click to only download it?
Assuming the user doesn't need to provide any input first that the document generation would depend on, then this should be possible by setting the value of the local variable holding the document ID to the integration that runs its generation process and returns the generated doc ID.