cancel
Showing results for 
Search instead for 
Did you mean: 

How to get the process instance id using expression?

douglascrp
World-Class Innovator
World-Class Innovator
I'm playing with Activiti Enterprise trial, and I'm developing a workflow where I have to create a identification for the workflow.
As what I need is to have a unique id, I thought about getting the instance id and use it.

Is there an easy way to get that value and set it as a form field?

At the end of the process, I have a Publish to Alfresco task, and I would like to use that value as the destination folder inside Alfresco.

If that is not an option, can you please suggest another idea?

Thank you.
2 REPLIES 2

cjose
Elite Collaborator
Elite Collaborator
process instance id can be used to uniquely identify an instance. If you want to display this id in your form, you can do the following:

Define a variable at the process level in your BPMN xml.
In your task forms, use a display value or display text field to show this variable.
After the process instance is started, you can use a script task/execution listener to set this variable value to process instance id.

Eg: If your variable name is "processId", you can set it as execution.setVariable("processId",execution.getProcessInstanceId())

Cheers,


douglascrp
World-Class Innovator
World-Class Innovator
Interesting.
I'm going to try it.
Thank you so much.