Anyone has experience with how to set up the flow, especially how do I catch the generated PDF from de start_table_report to be able to send it by email? Where does it, by default, get saved?
Hi Freddy,
This topic can be of use I think:https://community.thinkwisesoftware.com/topic/show?tid=1958&fid=89
Usually the complete flow of generating a report, saving it to disk, then sending it by e-mail, it is more handy to use a System flow to do that. That way the user does not have to sit and wait until the process flow has finished before continuing.
Start table report is not a process flow action which makes it unusable in a System flow. However, you want to send the report by e-mail so you'll need a SMTP connector to do that for you. This process action can be used inside a Process flow but now the problem is, where does the Report get saved so the SMTP connector can use it. As far as I know that is the Cache folder but this is only so the user can download the Report from their browser:
What you can do is put this Start table report at the start of a process flow, then after previewing the Report ask the user if he/she would like to send the report via e-mail. If no, then stop, if yes, then maybe show a Task pop-up with some additional fields to fill in if needed.
This then will cause a record to be inserted in a sort of Staging table which holds all Reports that need to be send to an address.
A system flow uses this table to determine if a Report has to be send, then takes one record, Generates the report using the Generate report process action (2022.1), Writes this report data to a file at a specified location, then an SMTP connector send an e-mail to the recipient and attaching this newly created PDF file to the e-mail.
Could that help out?
Hi
The alternative would be to use the HTTP connector after the start table task, but it's not very elegant in my opinion.
The other option you suggested to have the question to mail a report after creation has the same issue, where to I find the generated PDF to give it to the SMTP connector, because the report activity doesn't have any result variables.
< HTTP/2 401
< www-authenticate: Basic realm="Thinkwise Services"
< x-xss-protection: 1
< x-frame-options: SAMEORIGIN
< referrer-policy: same-origin
< x-content-type-options: nosniff
< content-security-policy: default-src 'self';
< date: Mon, 04 Apr 2022 14:40:20 GMT
Zie niet wat ik fout doe.
I fiddled around a bit more and now I got the following message:
2022-04-04T12:06:54.4217574-03:00 80000cda-0001-f000-b63f-84710c7967bb ERR] Process action 'get_report' in processflow 'email_empresa_summary_report' returned the following message: The external webserver (http://localhost/indicium/iam/rfbcnpj/empresa_summary_report) responded with the following error: 'The remote server returned an error: (422) Unprocessable Entity.' (5aa1648d)
What is an error 422?
Hello Freddy,
Status code 422 typically indicates that a mandatory report parameter was entered. Note that this also includes parameters that are made mandatory by a layout procedure.
When sending a POST request to a report endpoint of Indicium, you need to include a JSON body that contains the values of the report parameters. It is important that you specify the same report parameters that a user would enter in a report dialog in the GUI, no more, no less and in the same order. Indicium will process these report parameters in order and call the layout and default procedures where necessary. At the end, Indicium will validate if all mandatory parameters (according to the layout procedure given the final state of the report parameter values) are entered. If not, you will get a 422 response.
Another reason to get a 422 response is related to having a report parameter with a file storage configuration and not providing file in the correct way. The value of a file parameter should be an object with a FileName property that contains the file name and a File property that contains a base 64 binary string of the file data. If either one is missing, you can also receive a 422 response.
I hope this helps.
Hello Freddy,
Status code 422 typically indicates that a mandatory report parameter was entered. Note that this also includes parameters that are made mandatory by a layout procedure.
When sending a POST request to a report endpoint of Indicium, you need to include a JSON body that contains the values of the report parameters. It is important that you specify the same report parameters that a user would enter in a report dialog in the GUI, no more, no less and in the same order. Indicium will process these report parameters in order and call the layout and default procedures where necessary. At the end, Indicium will validate if all mandatory parameters (according to the layout procedure given the final state of the report parameter values) are entered. If not, you will get a 422 response.
Another reason to get a 422 response is related to having a report parameter with a file storage configuration and not providing file in the correct way. The value of a file parameter should be an object with a FileName property that contains the file name and a File property that contains a base 64 binary string of the file data. If either one is missing, you can also receive a 422 response.
I hope this helps.
I understand, but I don't think I am missing anything. I even used the example posted in this thread:
Has this something to do with a hidden parameter?
And as for the file, as I understood from the post.. the report response will be the report and I catch it with a 'NVARCHAR(MAX)' variable.
Hello Freddy,
Yes, since a hidden parameter cannot be entered by the user, you cannot provide a value for it in the request body. Since this parameter is mandatory as well, the only way to successfully call this report as it stands right now is for this parameter to be entered by a default procedure or the tab_report_parmtr context.
So your options are the following:
- Make the report parameter Regular.
- Set the value of the report parameter in the default procedure (or use a default value in the model).
- If the report is linked to a table and this hidden report parameter is linked to a column in that table then call the report like this: https://localhost/indicium/iam/rfbcnpj/my_table(my_key_column=123)/report_empresa_summary_report
I hope this helps.
Hello Freddy,
Yes, since a hidden parameter cannot be entered by the user, you cannot provide a value for it in the request body. Since this parameter is mandatory as well, the only way to successfully call this report as it stands right now is for this parameter to be entered by a default procedure or the tab_report_parmtr context.
So your options are the following:
- Make the report parameter Regular.
- Set the value of the report parameter in the default procedure (or use a default value in the model).
- If the report is linked to a table and this hidden report parameter is linked to a column in that table then call the report like this: https://localhost/indicium/iam/rfbcnpj/my_table(my_key_column=123)/report_empresa_summary_report
I hope this helps.
Can i use variables in the HTTP request URL? In Insomnia it works, the url, but it seams that in the SF the variable doesn't get 'translated'
Hello Freddy,
You can, you have to use curly brackets { }.
Hello Freddy,
You can, you have to use curly brackets { }.
I get the email, with an attachment, but the report is empty (blank), though 1.1 MB.. if I run the report through the GUI it does get filled. Any ideas?
Hello Freddy,
Try using a varbinary(max) process variable to catch the report file data in. In general, it is always recommended to use a binary data type when dealing with files. Data types like varchar and nvarchar are really only useful when dealing with plain text files, which is an edge case.
Hello Freddy,
Try using a varbinary(max) process variable to catch the report file data in. In general, it is always recommended to use a binary data type when dealing with files. Data types like varchar and nvarchar are really only useful when dealing with plain text files, which is an edge case.
These little details.. already thought it was a varbinary
Thanks.. did the trick indeed.. it's working now.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.