trigger process with email, read attached csv file

499 views
Skip to first unread message

runmypro...@gmail.com

unread,
Feb 8, 2015, 2:52:16 PM2/8/15
to suppor...@runmyprocess.com
Hello,

I am a real newbie and I would like to have some help with the setup of a new process.

I want to do the following:

trigger a process with an e-mail. (I managed to get this part by myself)
this email has a csv file as attachment. (2 rows: 1 header row+ 1 values row).
I need to get the content of this csv into a webinterface (for checking, adding missing fields and approving).
And finally the (approved, and updated) fields needs to be put back in a csv file and send as a mail attachment to a specific mailaddress.


This is what I did:
I created a start event with the trigger type: message
I created an input Data file (with name: myfile; checked Parsed; and selected the format: CSV with header)
I selected myfile in the Map attachment to selection
I also selected as Parsing format: CSV with header.

I don't know how to get the CSV data and put it into the webinterface.
And if I succeed in this, I am also struggling in getting these (in the webinterface possibly manually changed) variables back into a CSV attachment which can be mailed to a specific mailaddress.

Can somebody tell me if this is possible and if so, point me in the right direction?

Thanks a lot for any help in this matter!

Sweta Suman

unread,
Feb 8, 2015, 5:33:16 PM2/8/15
to suppor...@runmyprocess.com
Hi,

You have correctly configured the start activity.In order to get CSV in WI follow below steps-

1) Create a WI and take a Text input(e.g edit_json).

2) Next to start activity take a "Manual Acivity" which will edit/approve the csv. In input variable of activity write below code- 

<#assign tmp=file_content("${testfile[0].ref}","BASE64")>
                ${decode("BASE64",tmp)}

and store it with name edit_json.

here, ${testfile[0].ref} contains fileid of csv file. You can get this from process-->parameter-->initial parameter.

Please find attached screenshot for better understanding.

If you are still facing any problem, please revert back.

Thanks and Regards,
Sweta


--
Fujitsu - RunMyProcess
---
You received this message because you are subscribed to the Google Groups "RunMyProcess Support Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to supportforum...@runmyprocess.com.
To post to this group, send email to suppor...@runmyprocess.com.
Visit this group at http://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/e154bd9c-88f3-461a-9bb8-c32efbcd37d6%40runmyprocess.com.
For more options, visit https://groups.google.com/a/runmyprocess.com/d/optout.

process_input_variable.png
process_result.png

runmypro...@gmail.com

unread,
Feb 9, 2015, 3:36:03 PM2/9/15
to suppor...@runmyprocess.com
Hello Sweta,

Thank you for your clear explanation. I managed to get the csv data into a field the WI! So the first and second step are completed.
Now I am struggling with step 3:

The content of my test csv file is:
row 1 of the csv contains 3 fields (header1, header2, header3)
row 2 of the csv contains 3 fields (data1, data2, data3)

So the csv data is now displayed in the edit_json variable as:
Header1, Header2, Header3data1, data2, data3

How can I get this data in 3 separate fields, with the data from the 1st row (e.g. Header1) as the label of this field and the data of the 2nd row (e.g. data1) as the content of this field? I tried to create 3 seperate text inputs but I don't now if this is possible and How to break the edit_json variable into 3 parts.

Your help is again very much appreciated, because I can't figure this out for myself yet.

Sweta Suman

unread,
Feb 11, 2015, 1:52:18 AM2/11/15
to suppor...@runmyprocess.com
Hi,

Sorry for delay in response.

You have to bind values with either Text input/Array widget to display separately.
In the process "Manual activity" input variable store the CSV into collection.On WI retrieve values from collection and show it in array widget/text input. On submit of WI,you can update the collection.


Use- ${import_objects("file id", "collection_name", ",", "true")} to insert the csv file data into collection. 

Header of csv should be predefined as array column ,only you need to set the values dynamically in it using java script.

If you still face any problem, please revert back.

Thanks and Regards,
Sweta


--
Fujitsu - RunMyProcess
---
You received this message because you are subscribed to the Google Groups "RunMyProcess Support Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to supportforum...@runmyprocess.com.
To post to this group, send email to suppor...@runmyprocess.com.
Visit this group at http://groups.google.com/a/runmyprocess.com/group/supportforum/.

Sweta Suman

unread,
Feb 11, 2015, 9:43:45 AM2/11/15
to suppor...@runmyprocess.com
Hi,

Adding to my previous post if you want Header 1 as the label of this field and the the data 1 as the content of this field. You have to create dynamic Text Input and bind its values dynamically. 


Thanks,
Sweta

martinm...@gmail.com

unread,
Feb 11, 2015, 2:34:03 PM2/11/15
to suppor...@runmyprocess.com
Hello Sweta,

Thank you for your reply. I tried to store the CSV into a collection.

I put the folowing script into a new input variable of the manual activity.(I cleared the field name of the NewVar, so it didn't get assigned to a new variable.)

${import_objects("e29403e0-b162-11e4-8763-1231380c7265", "imported_csv", ",", "true")}

But when I send the mail with the attached CSV to my process, I got the following error message:

"
2015-02-11T19:00:03+0000 - Task "edit csv attachment" (id: 1[0] - status: ABORTED): Error while processing {import_objects("e29403e0-b162-11e4-8763-1231380c7265", "imported_csv", ",", "true")}

com.runmyprocess.error.config.UnauthorizedUser: Unauthorized: Collection does not have a valid configuration. Please contact your administrator.
"

So it looks like I am doing something wrong, but I can't figure out what. Do you have any idea?

Thanks

Bidisha Das

unread,
Feb 11, 2015, 9:59:28 PM2/11/15
to suppor...@runmyprocess.com
Hi,
If you are attaching the file in a Web Interface and then triggering the process,then you can't put the id of the file directly in import_objects.You need to check the process initial parameters what variable stores the id of the file which you have attached and use that variable in place of file id in import_objects. Also make sure that you are using correct Collection name.
If you want the CSV data should append with the existing data in collection,then you can write false inside import_objects or else write true which will drop the existing collection data and insert completely new data.

Please let me know if your issue got resolved.



Thanks & Regards
Bidisha



Bidisha Das

unread,
Feb 11, 2015, 10:23:33 PM2/11/15
to suppor...@runmyprocess.com
Hi,
Adding to my above reply,please check with the access rights as well if the person initiating the process has right to write in collection. Please refer to: http://docs.runmyprocess.com/Developer_Guide/Rights/Access_Rights  

Also let me know if you have checked "Read Only" mode for Collection and whether you are running your application in test or acceptance mode?



Thanks & Regards
Bidisha

martinm...@gmail.com

unread,
Feb 12, 2015, 3:41:35 AM2/12/15
to suppor...@runmyprocess.com
Hello Bidisha,

Thank you for your reply.

I thought that the fileID of the attached csv file would stay the same, so I used the fileid of a previous imported file. But now I see that this fileid changes everytime I send a new mail with an attachment. (see screenshot)

So I think I need to change the fileid I used "e29403e0-b162-11e4-8763-1231380c7265" into the fileid of the csv file of the attachment, but I don't know how to do this. I tried to replace the fileid with "${testfile[0].ref}", but this didn't work either...



about the collection: I created a new collection named imported_csv in the project and checked Public access and I didn't check the Read Only box. Is this the correct way? (see screenshot).

As I mentioned before, this is all very new to me (I don't have a programming background), and I am still in the trial period trying to evaluate if RunMyProcess will be a good tool for our company, but I really feel stuck at this simple process. Perhaps you can send me some screenshots of where I should put what code.

Thank you in advance.
inputvariables.jpg
process_start.jpg

martinm...@gmail.com

unread,
Feb 12, 2015, 3:43:04 AM2/12/15
to suppor...@runmyprocess.com, martinm...@gmail.com
I forgot one screenshot with my last post
created_collection.jpg

Bidisha Das

unread,
Feb 12, 2015, 6:31:06 AM2/12/15
to suppor...@runmyprocess.com
Hi,
In order to find the file id, you need to check the process initial parameters after your Process gets triggered.After you fire the process via email ,
go to Project definition->New->Report->Process Report->Change the mode to Test->Search Results->go into that Process->Parameters->Initial parameters.
You can find the variable which contains the file content (along with id) which you sent to RMP via email. I have attached a screenshot for your reference..



Thanks & Regards
Bidisha
File_id.png

Sweta Suman

unread,
Feb 12, 2015, 7:28:12 AM2/12/15
to suppor...@runmyprocess.com
Hi,

Yes,you are correct each time process is triggered it create a new file on RMP server with unique file id.

To save in collection write ${import_objects("${testfile[0].ref}", "imported_csv", ",", "false")}

As mentioned by Bidisha, If you want the CSV data should append with the existing data in collection,then should write false inside import_objects else true.

Collection - Public (no authentication needed) or private (authentication needed to be accessed) 
                  It is recommended to make collection as Read only.

Please find attached screenshot for better understanding.

If problem still persist,please revert back.

Thanks,
Sweta

--
Fujitsu - RunMyProcess
---
You received this message because you are subscribed to the Google Groups "RunMyProcess Support Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to supportforum...@runmyprocess.com.
To post to this group, send email to suppor...@runmyprocess.com.
Visit this group at http://groups.google.com/a/runmyprocess.com/group/supportforum/.
process.png

martinm...@gmail.com

unread,
Feb 13, 2015, 5:14:58 AM2/13/15
to suppor...@runmyprocess.com
Hi Sweta,

Thank you for your answer and the screenshot. (I didn't put a name in the field of the NewVar, that is why it didn't work)

Now I am able to show the fields in a report widget, but I still have not figured out how these fields can be edited by the user.

Can you explain me how to put this information in three separate text input widgets? (see attached screenshot to understand what I want to achieve)
OR: if there is a better way to do this (without the separate text input widgets) please tell me how.

Thank you in advance
collection_to_textinput.jpg

Sweta Suman

unread,
Feb 13, 2015, 6:13:19 AM2/13/15
to suppor...@runmyprocess.com, martinm...@gmail.com, suppor...@runmyprocess.com
Hi,

Report widget is used basically to display the records.

You can display and modify CSV data in two ways -

Using array widget

1) Take an array widget with 4 columns named as ID, Header1, Header2, java script and type of widget as Number Input,Text input,Text input,and java script respectively.

2) Add collection to Web Interface.

3) Write below script in 4th column of array(javacsript).

   function list_ok(result) 
     {
        alert("ok=" + JSON.stringify(result));
// set value to array widget
                id_array.id_id[P_index].setValue(result[0].id);  
id_array.id_header1[P_index].setValue(result[0].header1);
id_array.id_header2[P_index].setValue(result[0].header2);
     }

   function list_ko(result)
    {
        alert("ko=" + JSON.stringify(result));
    } 
//retrieve all values from collection
var my_pattern = {};
id_collection.listCallback(my_pattern,{},list_ok,list_ko);


Using Text Widget

1) Take text input widget as Id,Header1,Header2.

2) Add collection to Web Interface.

3) Take a Js widget and write above script and replace id_array.id_header1[P_index].setValue(result[0].header1) with RMPApplication.set("Header1", result[0].header1);


If you are still facing any problem, please revert back.

Thanks and Regards,
Sweta

martinm...@gmail.com

unread,
Feb 13, 2015, 10:23:37 AM2/13/15
to suppor...@runmyprocess.com, martinm...@gmail.com
Hi Sweta,

I managed to fill the text widgets with the data of the collection! Thanks.

Now I run into another question, because with this script, I always retreive the data from the 1st row (result[0]) of the collection. But we will receive multiple mails, so is it possible to fill the text widgets with the row which belongs to the csv file which is processed?
I guess the [0] must be made a variable based on the csv file and the ID nr of the row which is processed.

I took another screenshot to clearify this with an example:
In this example, a user will have to check the 3rd csv file which was received (ID=3), but the data retreived in the text fields belong to the line with ID=1

Thanks
always_1st_line.jpg

Sweta Suman

unread,
Feb 13, 2015, 6:13:39 PM2/13/15
to suppor...@runmyprocess.com
Hi,

Report widget is used basically to display the records.

You can display CSV data in two ways -

Using array widget

1) Take an array widget with 4 columns named as ID, Header1, Header2, java script and type of widget as Number Input,Text input,Text input,and java script respectively.

2) Add collection to Web Interface.

3) Write below script in 4th column of array(javacsript).

   function list_ok(result) 
     {
        alert("ok=" + JSON.stringify(result));
// set value to array widget
                id_array.id_id[P_index].setValue(result[0].id);  
id_array.id_header1[P_index].setValue(result[0].header1);
id_array.id_header2[P_index].setValue(result[0].header2);
     }

   function list_ko(result)
    {
        alert("ko=" + JSON.stringify(result));
    } 
//retrieve all values from collection
var my_pattern = {};
id_collection.listCallback(my_pattern,{},list_ok,list_ko);


Using Text Widget

1) Take text input widget as Id,Header1,Header2.

2) Add collection to Web Interface.

3) Take a Js widget and write above script and replace id_array.id_header1[P_index].setValue(result[0].header1) with RMPApplication.set("Header1", result[0].header1);


If you are still facing any problem, please revert back.

Thanks and Regards,
Sweta

--
Fujitsu - RunMyProcess
---
You received this message because you are subscribed to the Google Groups "RunMyProcess Support Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to supportforum...@runmyprocess.com.
To post to this group, send email to suppor...@runmyprocess.com.
Visit this group at http://groups.google.com/a/runmyprocess.com/group/supportforum/.

Sweta Suman

unread,
Feb 13, 2015, 6:13:40 PM2/13/15
to suppor...@runmyprocess.com
Hi,

Report widget is used basically to display the records.

You can display and modify  CSV data in two ways -

Using array widget

1) Take an array widget with 4 columns named as ID, Header1, Header2, java script and type of widget as Number Input,Text input,Text input,and java script respectively.

2) Add collection to Web Interface.

3) Write below script in 4th column of array(javacsript).

   function list_ok(result) 
     {
        alert("ok=" + JSON.stringify(result));
// set value to array widget
                id_array.id_id[P_index].setValue(result[0].id);  
id_array.id_header1[P_index].setValue(result[0].header1);
id_array.id_header2[P_index].setValue(result[0].header2);
     }

   function list_ko(result)
    {
        alert("ko=" + JSON.stringify(result));
    } 
//retrieve all values from collection
var my_pattern = {};
id_collection.listCallback(my_pattern,{},list_ok,list_ko);


Using Text Widget

1) Take text input widget as Id,Header1,Header2.

2) Add collection to Web Interface.

3) Take a Js widget and write above script and replace id_array.id_header1[P_index].setValue(result[0].header1) with RMPApplication.set("Header1", result[0].header1);


If you are still facing any problem, please revert back.

Thanks and Regards,
Sweta

Sweta Suman

unread,
Feb 16, 2015, 5:40:58 AM2/16/15
to suppor...@runmyprocess.com, martinm...@gmail.com

Hi,

You can create dynamic text input and bind its value with collection using loop.But you can create text input only above and below and not on the side of WI. To make it presentable and properly aligned I would suggest you to create array widget.

Take a js outside array and add below script in  function list_ok(result) mentioned above-

var count= result.length ;
    for(i=0;i<result.length;i++)
{
           alert(result.length);
   id_my_array.insertRow(i);
   id_my_array.id_id[i].setText(result[i].id);
           id_my_array.id_header1[i].setText(result[i].header1);
           id_my_array.id_header2[i].setText(result[i].header2);
     }
   
id_my_array.removeRow(count);

Hope this helps you.

Thanks,
Sweta

Sweta Suman

unread,
Feb 17, 2015, 4:52:12 AM2/17/15
to suppor...@runmyprocess.com, martinm...@gmail.com
Hi,

You can create dynamic text input and bind its value with collection using loop.But you can create text input only above and below and not on the side. To make it presentable and properly aligned I would suggest you to create array widget and create columns.


Take a js outside array and add following script in  function list_ok(result) mentioned above-


    for(i=0;i<result.length;i++)
{
           alert(result.length);
  id_my_array.insertRow(i);
  id_my_array.id_id[i].setText(result[i].id);
           id_my_array.id_header1[i].setText(result[i].header1);
           id_my_array.id_header2[i].setText(result[i].header2);
    }
  
id_my_array.removeRow(count);

Hope this helps you.

Thanks,
Sweta

--
Fujitsu - RunMyProcess
---
You received this message because you are subscribed to the Google Groups "RunMyProcess Support Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to supportforum...@runmyprocess.com.
To post to this group, send email to suppor...@runmyprocess.com.
Visit this group at http://groups.google.com/a/runmyprocess.com/group/supportforum/.

martinm...@gmail.com

unread,
Feb 17, 2015, 7:53:35 AM2/17/15
to suppor...@runmyprocess.com, martinm...@gmail.com
Thanks for your help Sweta, but this gets way too complicated for me. I will try to find a different way in doing this. perhaps I can attach a Json file directly instead of a CSV file.
Reply all
Reply to author
Forward
0 new messages