Getting Attachments from an e-mail to a File Upload Widget

196 views
Skip to first unread message

tsa...@br.fujitsu.com

unread,
Feb 26, 2018, 3:20:45 PM2/26/18
to Fujitsu RunMyProcess Developer Community
Hello, everyone.

I need some help in attaching files that were sent through e-mail to a File Upload widget.

I have a process that starts when a user sends and e-mail to RMP with some files attached (it's an expense approval flow, with photographs of the receipts).
The second step is where the user inputs the details of the expense, and has the File Upload widget (just in case the user forgot to attach a file or sent a file by mistake and needs to delete it).
I want to be able to get the list of files that were attached in the e-mail and put them into the File Upload widget.

Ihave attached a few screenshots, to show what I tried to do:

1. Mapping_Message_To_Variables.png:
I mapped the attachments of the e-mail to the variable "email_files".

2. Mapping_Attachments.png:
The "email_files" is a Files format.

3. Input_Variables.png
The input variable for the manual task.
In this case, "expenses_upload" is my File Upload Widget.

4. Attaching_File_To_Widget.png
This is the script I used to attach the files to the File Upload Widget.
I assigned a list of IDs (all_mail_attachments) and put in the IDs contained in email_files.
Then, I used the attach_file method to put them into the File Upload widget.

Personally, I'm pretty sure I messed up somewhere in step 3 or 4, since I get an error in the beginning of the manual task.
However, since I couldn't find any documentation on how to create this, I was doing some try-and-error approach.

I would appreciate any help that I can get.

Best regards,
Tadeu Sakoda (Fujitsu do Brasil)

2. Mapping_Attachments.png
3. Input_Variables.png
4. Attaching_File_To_Widget.png
1. Mapping_Message_To_Variables.png

Ghanshyam Mule

unread,
Feb 26, 2018, 3:40:09 PM2/26/18
to Fujitsu RunMyProcess Developer Community, tsa...@br.fujitsu.com
Hello Sir,

Could you please share error details as you are facing while designing above scenario.

Regards,
Ghanshyam
Fujitsu RunMyProcess Support 


--
Fujitsu - RunMyProcess
---
You received this message because you are subscribed to the Google Groups "Fujitsu RunMyProcess Developer Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to supportforum+unsubscribe@runmyprocess.com.
To post to this group, send email to suppor...@runmyprocess.com.
Visit this group at https://groups.google.com/a/runmyprocess.com/group/supportforum/.
To view this discussion on the web visit https://groups.google.com/a/runmyprocess.com/d/msgid/supportforum/8c6c8b1b-a6db-4cc7-a968-5a4123c63db5%40runmyprocess.com.
For more options, visit https://groups.google.com/a/runmyprocess.com/d/optout.

tsa...@br.fujitsu.com

unread,
Feb 26, 2018, 4:00:27 PM2/26/18
to Fujitsu RunMyProcess Developer Community, tsa...@br.fujitsu.com
Hello, Ghanshyam.

Thank you for helping me out on this matter.

Silly me... I forgot to put the error.
Please check the attached file for details on the error (Unexpected error: null... very helpful...) and the initial parameters.

If you have any questions or comments, please feel free to contact me.

Best regards,
Tadeu Sakoda
> To unsubscribe from this group and stop receiving emails from it, send an email to supportforum...@runmyprocess.com.
5. Error_Message.png

Ghanshyam Mule

unread,
Feb 27, 2018, 6:59:18 PM2/27/18
to Fujitsu RunMyProcess Developer Community, tsa...@br.fujitsu.com
Hello  Sir,

As per screenshot, you are getting null error in expense _upload variable because  all_mail_attachments variable is not able to store value of email attached file ref values into it .

If there are more than 2 attachments in email & you are trying use P_json_put function then it stores ref of last file. To store all ref of attached file in email you need to use P_json_accumulate function.
 
Please try below given script to fix error

<#assign all_mail_attachments=[]>
<#assign file_attachment={}>
<#list email_files as x>
<#assign file_attachment=P_json_accumulate(file_attachment,"ref",x.ref)>
</#list>
 ${file_attachment}


Please feel free to contact us if you have any queries.

Thanks & Regards,
Ghanshyam
Fujitsu RunMyProcess Support




To unsubscribe from this group and stop receiving emails from it, send an email to supportforum+unsubscribe@runmyprocess.com.

To post to this group, send email to suppor...@runmyprocess.com.
Visit this group at https://groups.google.com/a/runmyprocess.com/group/supportforum/.
output.JPG

Ghanshyam Mule

unread,
Mar 1, 2018, 3:10:18 PM3/1/18
to Fujitsu RunMyProcess Developer Community, tsa...@br.fujitsu.com
Hello Sir,

Have you checked solution suggested in last post?

We are waiting for your reply.

Thanks & Regards,
Ghanshyam 

tsa...@br.fujitsu.com

unread,
Mar 1, 2018, 3:29:59 PM3/1/18
to Fujitsu RunMyProcess Developer Community, tsa...@br.fujitsu.com

Hello, Ghanshyam.

Sorry for my late reply.

To be sincere, the solution presented did not work for me.
I found a workaround to show the files using an array and an HTML widget to show the preview (I got it from another sample).

What I wanted to do was to show the files in the Upload Widget, but even looking at the RMP_FileUpload JS page, I couldn't find something that would work.
The closest I got was to simulate the file upload through JS, but that would be quite troublesome and most likely wouldn't work...
As such, I decided to make it simple and just show it in the array.

If you could give me any insights on how to show a file uploaded through e-mail attachment in the Upload Widget, I would appreciate.
I don't know if I'll use it in my current project (due to time constraints), but I will definitely consider using it in future projects.

Best regards,
Tadeu Sakoda

Reply all
Reply to author
Forward
0 new messages