cancel
Showing results for 
Search instead for 
Did you mean: 

Moving forward in a workflow automatically in Java. [SOLVED]

jimcornmell
Champ in-the-making
Champ in-the-making
Hi All,

I have a post which relates to starting a job in a workflow assigned to a pool of people, http://forums.alfresco.com/viewtopic.php?t=9966.  I have not had any luck with this so I'm trying a different technique, i.e. adding an extra step in the workflow, and moving forward automatically.  I.e. making a different problem which I might be able to solve.  Unfortunately I'm not having any luck with this either :cry:

So this post is about moving forward in a workflow automatically.  I already have a Java class which populates and starts the workflow and this works well.  At the end of this I want to move forward (where I allocate the task to a pool) in the workflow.  I've tried the following 4 calls, which look to be in a relavant part of the API but with no luck:
workflowService.fireEvent(path.id, "Send to first task"); 
workflowService.fireEvent(path.id, null);
workflowService.signal(path.id, null);
workflowService.signal(path.id, "Send to first task");
Does anyone else have any more ideas?

Thanks in advance for your help.  Oh yeh and Merry Christmas…..

Jim
1 REPLY 1

jimcornmell
Champ in-the-making
Champ in-the-making
Hi,

This is now solved.  The key is to create a workflow with an initial state and then the next state to be in a pool.  When starting the workflow the following does the trick to move it onto the next step (and hence the pool).

String assignee  = "GROUP_artists";
parameters.put(WorkflowModel.ASSOC_ASSIGNEE, assignee);
WorkflowPath path = workflowService.startWorkflow(workflowDef.id, parameters);
Iterator<WorkflowTask> wit = workflowService.getTasksForWorkflowPath(path.id).iterator();
WorkflowTask startTask = wit.next();
workflowService.endTask(startTask.id, null);

Notice the null parameter on the endTask.

Jim