5.22 get process instance creater in script task

cancel
Showing results for 
Search instead for 
Did you mean: 
long241191
Member II

5.22 get process instance creater in script task

Hi all.

I'm using activiti v5.22, and in script task i want assign creater username into my string.

I found one solution is use ${initiator}, but i can use in script task content;

ex: var message = "Hello " + ${initiator}.

How can I do this? 

Many thanks.

3 Replies
daisuke-yoshimo
Senior Member

Re: 5.22 get process instance creater in script task

var message = "Hello " + execution.getVariable("initiator");

Activiti User Guide 8.5.2. Script Task 

long241191
Member II

Re: 5.22 get process instance creater in script task

I have try, no error when execute, but result is NULL

message = "Helllo null";

daisuke-yoshimo
Senior Member

Re: 5.22 get process instance creater in script task

If you set the initiator setting as the start event, you can get it.

initiator: identifies the variable name in which the authenticated user id will be stored when the process is started. Example:

Activiti User Guide 8.2.6. Start Events 

1. initiator setting in bpmn

<startEvent id="request" activiti:initiator="initiator" />

2. If you set the above, you can get it with the following script.

var message = "Hello " + execution.getVariable("initiator");