Hi All,Below is part of some code I'm generating to start a workflow task in Java. The problem I'm having is starting the task in a pool, rather than a user. If anyone can let me know how to do this that would be great.I've tried several things including setting the parameter WorkflowModel.ASSOC_ASSIGNEE to be the name of the pool, GROUP_NameOfPool. But this does not work. I've also tried setting ASSOC_POOLED_ACTORS but then the workflow does not start at all.Appologies for the state of the code, it's not production quality yet.Thanks in advance.Jim….
// Get a list of workflow definitions and search through them for the one we want.
// Not sure if this is the best way to do this, but it seems to work.
List<WorkflowDefinition> workflowDefs = workflowService.getDefinitions();
Iterator<WorkflowDefinition> workflowDefsIterator = workflowDefs.iterator();
WorkflowDefinition workflowDef = null;
// Get a handle to the required workflow.
while (workflowDefsIterator.hasNext()) {
workflowDef = workflowDefsIterator.next();
if (workflowDef.name.equals(JBPM_WORKFLOW_NAME)) {
break;
}
}
// If we did not find the workflow error.
if (!workflowDef.name.equals(JBPM_WORKFLOW_NAME)) {
return;
}
// Add the files to the workflow.
// First create the workflow, passing a null since this seems to be the most appropriate.
NodeRef workflowNodeRef = workflowService.createPackage(null);
for (int x = 0; x < fileList.length; x++) {
nodeService.addChild(workflowNodeRef, fileRefs[x], ContentModel.ASSOC_CONTAINS, QName.createQName(NamespaceService.CONTENT_MODEL_PREFIX, "Advert within the workflow package"));
}
// Finally kick the workflow off.
Map<QName, Serializable> parameters = new HashMap<QName, Serializable>();
parameters.put(WorkflowModel.ASSOC_PACKAGE, workflowNodeRef);
parameters.put(WorkflowModel.ASSOC_ASSIGNEE, "GROUP_NameOfPool");
parameters.put(WorkflowModel.PROP_WORKFLOW_DUE_DATE, new Date(System.currentTimeMillis() + DUE_HOURS.getTime()));
parameters.put(WorkflowModel.PROP_WORKFLOW_DESCRIPTION, "Name of task");
WorkflowPath path = workflowService.startWorkflow(workflowDef.id, parameters);
….