Updating a parameter in a batch of processes - sample code?

446 views
Skip to first unread message

tom....@mycit.ie

unread,
Aug 13, 2013, 12:12:04 PM8/13/13
to suppor...@runmyprocess.com
I have > 100 processes that were initialised with an incorrect parameter value. To avoid manually opening each of them and adding a Computed parameter with the correct value, I'm hoping it's possible to create a process to do this using the RunMyProcess API. Is there any sample code available that implements the equivalent of:

for each process P returned by process report A do
set P.Computed.param = Y
end do

Gareth Thiveux

unread,
Aug 13, 2013, 2:29:32 PM8/13/13
to suppor...@runmyprocess.com
Hi Tom,

There's no code to perform that, you'll need to design a process to do the job.
I'll design a draft version of the process you would need on my side and share with you some screenshots of it to help you design yours.
I'll try to find a slot tomorrow to do that.


Regards, 

Pre-Sales Consultant / Consultant Avant-Vente
 Fujitsu RunMyProcess
22 rue Chauchat, 75009 Paris - France (GMT+1)

     


Fujitsu RunMyProcess user? Please add a review on GoogleApps Marketplace

Afin de contribuer au respect de l'environnement, merci de n'imprimer ce message qu'en cas de nécessité.
Be environmentally friendly: do not print this email unless it is entirely necessary.


2013/8/13 <tom....@mycit.ie>

--
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/76c51e49-f029-403c-b294-2f436c69549b%40runmyprocess.com?hl=en.
For more options, visit https://groups.google.com/a/runmyprocess.com/groups/opt_out.



Gareth Thiveux

unread,
Aug 19, 2013, 12:09:24 PM8/19/13
to suppor...@runmyprocess.com
Hi Tom,

Sorry for late reply, here's the process you need :
Images intégrées 1
First box will list and store in an array all the IDs of the instances you want to update.
Second box will loop on this array and call a subprocess to update each instance.

1) Start event
a. Output variables
Please find below the output variables (and their values) you should create on the start event of the process.
  • current : 0
  • end : false
  • list_instance_ids : []
Images intégrées 1


2) List processes instances box
This box is a loop on a Connector.
The connector you need is the "Get anything (xml output V1)", that you can find in the connector library, under the "RunMyProcess - Secured Connection" provider.
Images intégrées 3

The loop has to be configured as a While loop, with end="false" as its condition.
Images intégrées 4

a. Input variables
The only input variable is rmp_url, and it should contain the URL of your process report containing all the instances you want to update.
Images intégrées 5

To retrieve the URL of your report, open your process report within the portal, and click on the RSS feed icon :
Images intégrées 7

Then copy the URL of the page that has just opened, without the https://live.runmyprocess.com/
Finally, in the URL, replace (1) nb=20 by nb=100 and (2) first=0 by first=${current}
Here you have your rmp_url value.
Images intégrées 9


b. Output variables
You've got 3 output variables here :
  • current ${current?number+100}
  • list_instance_ids :
<#assign tmp=list_instance_ids>
<#if P_result.feed.entry?exists>
<#if P_result.feed.entry?is_sequence>
<#list P_result.feed.entry as x>
<#assign tmp=tmp+["${x.id}"]>
</#list>
<#else>
<#assign tmp=tmp+["${P_result.feed.entry.id}"]>
</#if>
</#if>
${tmp}
  • end :
<#if P_result.feed.entry?exists>false<#else>true</#if>
Images intégrées 6


3) Update instances box
This box is a loop on a Subprocess.
The subprocess you will have to create and plug here is the one shown below. We'll come back to it later on.
Images intégrées 2
Images intégrées 10

The loop has to be configured as a Multi-instance sequential loop, with ${list_instance_ids} as its array.
Images intégrées 11

a. Input variables
  • current_instance ${list_instance_ids[P_index]}
Images intégrées 12


b. Subprocess
Images intégrées 13

3.1) Get instance details connector box
This box is a Connector.
The connector you need is the "Get details of a process instance", that you can find in the connector library, under the "RunMyProcess - Secured Connection" provider.
Images intégrées 14


a. Input variables
  • P_customer : ${P_customer}
  • request_id : ${current_instance}
Images intégrées 16

b. Output variables
  • computed : ${P_result.feed.entry[1].content.P_value}
  • execution_path : ${P_result.feed.entry[3].content.P_value}
Images intégrées 17


3.2) Update instance connector box
The connector you need is the "Modify process request instance", that you can find in the connector library, under the "RunMyProcess - Secured Connection" provider.
Images intégrées 15


a. Input variables
  • comment : You can put the comment you want (it's just like the comment you type in when you restart a process)
  • P_customer : ${P_customer}
  • computed : ${computed}
  • computed.the_name_of_the_variable_you_want_to_update : the updated value of your variable
  • computed${encrypt('BASE64',computed)}
  • execution_path : ${execution_path}
  • request_id : ${request_id}
  • state : 102
Images intégrées 19


That's all !
Hope that's clear enough


Regards,

Pre-Sales Consultant / Consultant Avant-Vente
 Fujitsu RunMyProcess
22 rue Chauchat, 75009 Paris - France (GMT+1)

     


Fujitsu RunMyProcess user? Please add a review on GoogleApps Marketplace

Afin de contribuer au respect de l'environnement, merci de n'imprimer ce message qu'en cas de nécessité.
Be environmentally friendly: do not print this email unless it is entirely necessary.


2013/8/13 Gareth Thiveux <gthi...@runmyprocess.com>
2013-08-19_15h20_45.png
2013-08-19_15h26_19.png
2013-08-19_15h26_34.png
2013-08-19_16h56_15.png
2013-08-19_15h26_58.png
2013-08-19_15h27_04.png
2013-08-19_15h24_35.png
2013-08-19_15h26_04.png
2013-08-19_15h26_40.png
2013-08-19_15h26_12.png
2013-08-19_15h20_28.png
2013-08-19_15h25_09.png
2013-08-19_15h20_45.png
2013-08-19_16h55_59.png
2013-08-19_15h26_50.png
2013-08-19_15h25_03.png
2013-08-19_15h25_26.png
2013-08-19_15h25_49.png

tom....@mycit.ie

unread,
Aug 26, 2013, 3:02:17 PM8/26/13
to suppor...@runmyprocess.com
Thanks Gareth, it's a very comprehensive response!
I've implemented this to test stage and have two issues:

1) the RSS feed URL of the process report causes a failure - it contains some pipe characters (|) which Jave doesn't like. When I replaced each of these by %7C the problem was resolved.

2) after running the update process on a number of real processes, I checked the Revisions screen for each. The comment text in the most recent revision is garbled binary - it's not the text I supplied to the Update Process Instance RMP API call. I'm concerned that if the comment text is corrupt/wrongly encoded that other attributes of the process state may be similarly affected by the update. Is there a simple explanation for the unreadable comment text or is there any way to verify the integrity of process state after update?

Gareth Thiveux

unread,
Aug 27, 2013, 4:37:53 AM8/27/13
to suppor...@runmyprocess.com
Hi Tom,

My mistake, as specified in the description of the "Modify process request instance" connector, the comment variable also has to be base64 encoded :
Parameters :
comment : comment to be added to relaunch method in base64 (function encrypt)
computed : all computed parameter in base64 (function encrypt) - ${P_result.feed.entry[1].content.P_value} on Get process request instance
execution_path : not encoded - ${P_result.feed.entry[3].content.P_value} on Get process request instance
state : 102 (keep as current) - 103 (waiting for resume)


Regards,

Pre-Sales Consultant / Consultant Avant-Vente
 Fujitsu RunMyProcess
22 rue Chauchat, 75009 Paris - France (GMT+1)

     


Fujitsu RunMyProcess user? Please add a review on GoogleApps Marketplace

Afin de contribuer au respect de l'environnement, merci de n'imprimer ce message qu'en cas de nécessité.
Be environmentally friendly: do not print this email unless it is entirely necessary.


2013/8/26 <tom....@mycit.ie>
--
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/.

tom....@mycit.ie

unread,
Aug 28, 2013, 4:54:25 AM8/28/13
to suppor...@runmyprocess.com
That's all worked perfectly. Many thanks
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages