AnsweredAssumed Answered

Task generated without Resource

Question asked by sanket on May 24, 2010
Latest reply on May 24, 2010 by sanket
Hi Guise. I have created a rule "Add My Workflow to Item" to a space. So any Item arriving in the space will trigger my workflow. The task is
generated on the approver's dashboard with approve-reject button. That's fine. Just the problem is- When the approver opens his dashboard, he can see his task but not getting the "Resource" (file) on which the workflow is started.
I want to add the resource. Can u plz tell where am I going wrong ?


protected void executeImpl(Action arg0, NodeRef arg1) {
      WorkflowDefinition wd = null;
      NodeRef personNodeId =  getPersonService().getPerson("sanket");
      List a = getWorkflowService().getAllDefinitions();
      Iterator i = a.iterator();
      while (i.hasNext()) {
          wd = (WorkflowDefinition) i.next();
         System.out.println("workflow name—–>" + wd.name);

         if (wd.name.equals("jbpm$wf:review")) {
            System.out.println(wd.id);
            
         }
      }
      
      // Create a workflow node reference
      NodeRef workflowNodeRef = workflowService.createPackage(arg1);
      // Finally kick the workflow off.
      Map<QName, Serializable> parameters = new HashMap<QName, Serializable>();
      parameters.put(WorkflowModel.ASSOC_PACKAGE, workflowNodeRef);
      parameters.put(WorkflowModel.ASPECT_WORKFLOW_PACKAGE,workflowNodeRef);
      
      /*this.nodeService.addChild(workflowNodeRef, arg1,
                ContentModel.ASSOC_CONTAINS, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI,
                QName.createValidLocalName((String)this.nodeService.getProperty(
                      arg1, ContentModel.PROP_NAME))));*/
      
      
      NodeRef workflowPackage = (NodeRef)arg0.getParameterValue(WorkflowModel.ASSOC_PACKAGE.toPrefixString(namespaceService));
        workflowPackage = workflowService.createPackage(workflowPackage);
        ChildAssociationRef childAssoc = nodeService.getPrimaryParent(arg1);
        nodeService.addChild(workflowPackage, arg1, ContentModel.ASSOC_CONTAINS, childAssoc.getQName());

      parameters.put(WorkflowModel.PROP_WORKFLOW_DUE_DATE, new Date(System.currentTimeMillis()));
      parameters.put(WorkflowModel.PROP_WORKFLOW_DESCRIPTION, "Sanket,you are assigned a task");
      parameters.put(WorkflowModel.ASSOC_ASSIGNEE, personNodeId);
      
      WorkflowPath path = workflowService.startWorkflow(wd.id, parameters);
      
      System.out.println("initiated successfully");
      
   }

Outcomes