Hello, I would like to know after executing a!startProcess which generates a PDF file that should be downloaded from the portal.
Currently the following OnSucess does not work in the portal:
nSuccess: a!save( local!file,fv!processInfo.pv.pdfDocument )
In that case will that works at all in any other case scenario ? maybe with a!httpResponse
Discussion posts and replies are publicly visible
Can you explain in detail what "does not work" means?
Questions:
- Is that process started?
- Does in generate the document?
- Did you enable process chaining up to the document generating node?
- What would the httpResponse do?
Hello Stefan, the process is as follows: a User on a portal clicks on link that executes a!startprocess which generates the PDF, activity chaining is enabled and the file is being generated. with the first code in the case example basically it does not returns anything when tested in the Appian Portal. However tested in the interface editor it works and returns the data. The other approach which I was thinking is something like this:
a!save(local!file, a!httpResponse( headers: a!httpHeader( name: "Content-Disposition", value: fv!processInfo.pv.pdfDocument ), body: todocument(fv!processInfo.pv.pdfDocument) )
What this the response is WebApiReponse, I saw toJson function is not supported in Appian portals so trying to see if this response contains the file and If I can put it in the local variable. Hope this explanations helps.
You need to do a two-click process. First click generates the file. Then show a link to the user to download the file.
When you store fv!processInfo to a local variable, do you see the expected data?
Correct this is what I have currently set-up, if there is a value in local!file it will show the download button.
What it currently saves int he variable is as follows:
and the following error: Could not display interface. Please check definition and inputs. Interface Definition: Expression evaluation error at function a!documentDownloadLink [line 1144]: Could not cast from WebApiResponse to Document. Details: CastInvalidCould not cast from WebApiResponse to Document. Details: CastInvalid
Do this first, and validate it.
a!save(local!file, fv!processInfo)
This httpResponse can only be used in a web API!
As you have suggested this approach with Viewer permission for the process model did the job. Thanks.