cancel
Showing results for 
Search instead for 
Did you mean: 

start process instance by user

seba1
Champ in-the-making
Champ in-the-making
Hello,

I would like to start a new instance of a process from a java application.
Actually I find this:
 ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("myProcess");
But I would like to see the process status on Activiti Explorer with the admin user (kermit).
How I can assign a user or user group in my process intance ?

tanks for help.
16 REPLIES 16

jbarrez
Star Contributor
Star Contributor
Absolutely… maybe we just have *too much* docs Smiley Tongue

(btw, I had to look it up too, didn't remember if it was actually in the docs 😉 )

mitziuro
Champ in-the-making
Champ in-the-making
And in java code?

How do i take the task's process's owner (process initiator) ?

START_USER_ID_ from ACT_HI_PROCINST has a value for that process. (I've used the IdentityService solution Smiley Wink ).
task.getOwner() gives null. (I think it goes to ACT_HI_TASKINST's OWNER_)
Am I missing something?

Do I have to create a special process instance variable that stores the owner's value?

BR

frederikherema1
Star Contributor
Star Contributor
If you want to have the "process initiator", you should use the "activiti:initiator" xml-extention (see user guide) to capture the initiator in a variable. Later on, when you need this, you should get it from the process, rather than the task:


String intitiatingUser = runtimeService.getVariable("starter", task.getProcessInstanceId());

Task owner is a different concept, introduced for the more "adhoc" style of tasks. This is, by default, not used by the engine itself perse.

tomili
Champ in-the-making
Champ in-the-making
Everything's great when we are in root execution but it doesn't work when my main process flow crete (automatically) a sub-process (callactiviti) -  START_USER_ID_  still isn't set for this subproces. How can I change this?

jbarrez
Star Contributor
Star Contributor
Are you passing the variable that contains your start user to the sub process?

tomili
Champ in-the-making
Champ in-the-making
Hymm yes, I was trying to pass "initiator" variable which contains logged in user name "admin" 
and map it to "starter"/"initiator" variable in subproces - no effect
Thanks for reply…
TL>

jbarrez
Star Contributor
Star Contributor
Then something sounds wrong … could you file a bug with a simple failing process?