Page 1 of 1

Who started workflow?

PostPosted:Wed Apr 03, 2013 12:26 pm
by aliism
How can I store username of who started the workflow? :)

Re: Who started workflow?

PostPosted:Mon Apr 08, 2013 6:35 pm
by pavila
Go to http://docs.jboss.com/jbpm/v3/userguide ... ement.html and search for swimlane initiator.

Re: Who started workflow?

PostPosted:Wed Apr 10, 2013 5:52 am
by aliism
pavila wrote:Go to http://docs.jboss.com/jbpm/v3/userguide ... ement.html and search for swimlane initiator.
Thank you!

Re: Who started workflow?

PostPosted:Thu Apr 11, 2013 8:47 pm
by noxious
You can create an Assignment Handler like this one:
Code: Select all
public class GetWorkflowCreator implements AssignmentHandler {

	/**
	 * This class assigns the task at the user who started the workflow.
	 */
	private static final long serialVersionUID = 1L;

	@Override
	public void assign(Assignable assignable, ExecutionContext executionContext) throws Exception {
		// TODO Auto-generated method stub
		
		Session s = JCRUtils.getSession();
		String user = s.getUserID();
		s.logout();
		assignable.setActorId(user);
	}
}

Re: Who started workflow?

PostPosted:Fri Apr 12, 2013 2:34 pm
by pavila
The swimlane initiator way is the right one. The other proposed method won't work always.