05-15-2019 05:11 AM
Hi. Is there a variable I can use that holds the process instance id that I can pass during runtime to a rest call in the payload ?
Like this
{
"itemkey": "${id}"
}
05-16-2019 08:21 AM
Hi Jaco,
That should work. If this approach does not work, you can have a global variable at the process level and update them at every step and you can access directly activiti_ru_variable . It also depends on if your process is synchronous/asynchronous and make sure the Rest call gets the right process id before it moves to the next step.
In one of my use cases I use global variable to maintain the status of every task .That should definitely work .
05-15-2019 04:24 PM
execution.getProcessInstanceId();
This will always gives you the current process instance ID. If you need to access the instance of the process(Root Instance id) , you can try the below
execution.getParentId()
05-16-2019 01:06 AM
Hi, Sathya G. Thanks for the reply. The problem I have is that I start a BPM process from an Oracle Apex Page.
When you start a process it will execute all the way until it gets to a Human Task and then it will return to the calling Apex Page.
As part of the process, there are REST calls back to Oracle Procedures that update worklist items before it gets to the first Human Task. Those procedures need values that live inside process instance variables. So for that Oracle procedure to get to the process variables I need the Process ID. I will only know what the process ID is once the call returns to my calling Apex Page.
But if I can pass the Process id to the Oracle Procedure in the Rest call it will know what process to query on the Activiti side.
What I have done now is to place a Human task at the start with a timeout of 1 second. So when the Apex form creates the process it returns to the Form very fast and gives the Process Instance Id to the Form. The form then updates the request table with the Process ID. After the second when the process continues if will call the Oracle procedure than by this time now has the Process ID in the table and then all works.
Is there a default variable that I can use to pass the Process Instance ID to the Oracle Procedure via the payload?
Or can I use script code in that payload area to get the Process Instance ID ? There where I pass the CLAIM_NUMBER, I want to send the Process Instance ID also.
05-16-2019 01:18 AM
can I do it like this ?
{
"itemkey": "${CLAIM_NUMBER}" ,
"processid": "${execution.getProcessInstanceId()}"
}
05-16-2019 08:21 AM
Hi Jaco,
That should work. If this approach does not work, you can have a global variable at the process level and update them at every step and you can access directly activiti_ru_variable . It also depends on if your process is synchronous/asynchronous and make sure the Rest call gets the right process id before it moves to the next step.
In one of my use cases I use global variable to maintain the status of every task .That should definitely work .
Explore our Alfresco products with the links below. Use labels to filter content by product module.