cancel
Showing results for 
Search instead for 
Did you mean: 

Changing the initiator of the workflow

nehagupta
Champ in-the-making
Champ in-the-making
Hi,

I have a requirement to change the initiator of the workflow. The workflow is started by executing a rule which in turn calls the below javascript code :



function main()
{
   var name = document.name;
   var workflow = actions.create("start-workflow");
   workflow.parameters.workflowName = "activiti$activitiReview";
   workflow.parameters["bpm:workflowPackage"] = document;
   workflow.parameters["bpm:workflowDescription"] = "Please review " + document.name ;
   var assignee = people.getPerson("admin");
   workflow.parameters["bpm:assignee"] = assignee;
   workflow.execute(document);
  
}

main();



I want to set the initiator of the workflow to some other user and wants this user to be able to view history of the workflow. The original initiator should not be able to view history of workflow.
I tried below code to change the initiator :


workflow.parameters["initiator"] = people.getPerson("someone");


This doesnot change the initiator. I found this link http://stackoverflow.com/questions/25372893/reassigning-initiator-in-alfresco-activiti-workflow
which talks about changing the initiator. But it is not very clear. Can someone suggest a solution for the same. I am trying this on Alfresco Community 5.0.d .

Regards,
Neha
1 REPLY 1

niketapatel
Star Contributor
Star Contributor
Yes, This wont be possible to set or change initiator from script level, as its being set from process level variable.

You can check ActivitiWorkflowEngine.startWorkflow() which gets current authenticated user and sets it as initiator. So you may implement your custom listner and override this initiator.

Hope this helps!