I’m having an issue with returning the reportResult object from server and interpreting its name. I generated 2 different reports and had them emailed to myself. The attachment names were Roster_4145ae112a1aaa67fda89c1e7f93b402.pdf and Roster_463e918212c67f42843cf9ad0ea5fc8b.pdf.
When opening them in Preview, they were both the same Roster PDF. I will debug this myself, but the main question is How do I replace the cryptic name with “Roster_” + study group name? To do this, I need to know the field names in the reportResult object returned by the server-side generation. I can find no documentation on that object. Can you tell me if there is a report name field as part of that? can you supply an object model for that?
Or, failing that, can you tell me how to assign a name to the attachment before attaching it to the email?
Thanks…
Hi Ron,
I suggest you use five’s variable to send the study group name to the function DoAddAttachments. Then, in the function you can retrieve this variable and format the file name.
Note:
You cannot pass any extra value in the context to this function DoAddAttachments because the event (Do Merge Record) is restricted.
Example of what you can do:
Set the variable before calling Email action.
Clear the variable after calling the action
Retrieve the variable and format the name.
Result:
Regards,
Elton S
Thanks for this technique. I did the following:
five.setVariable('ReportGroupName', 'myReport');
const mailResult = five.executeAction('ReportEmail', mailContext);
five.clearVariable('ReportGroupName');
And I got this attachment:
This works just like your example.
But isn’t there a way to just return “myReport” without the GUID-like ending?
I would like to say something like “StudyGroupRoster_Acting Out”
thanks…
Hi Ron,
The GUID-like value is generated automatically and cannot be removed at this stage. I apologize for the inconvenience.
I have notified the development team so they can investigate and consider making it optional in the future.
Regards,
Elton S
Thanks, I’ll just have to live with this for now. Please notify me if this changes.