I am attempting to kick off a workflow in a Java webscript. I have succeeded in starting the workflow but I can not get the package/resource attached to the task when I start the workflow. Here is my code:
NodeRef temp = new NodeRef("workspace://SpacesStore/"+id);
WorkflowDefinition workflowDef = workflowService.getDefinitionByName("jbpm$adwf:approveContent");
ChildAssociationRef childAssoc = nodeService.getPrimaryParent(temp);
NodeRef pack = workflowService.createPackage(null);
nodeService.addChild(pack, temp, ContentModel.ASSOC_CONTAINS, childAssoc.getQName());
Map<QName, Serializable> parameters = new HashMap<QName, Serializable>();
parameters.put(WorkflowModel.ASSOC_PACKAGE, pack);
parameters.put(WorkflowModel.PROP_CONTEXT, childAssoc.getParentRef());
WorkflowPath path = workflowService.startWorkflow(workflowDef.getId(), parameters);
workflowService.signal(path.id, null);
I am trying to attache the NodeRef "temp" to the workflow. I get the task but no resource is attached to it.Thanks!