AnsweredAssumed Answered

Change Task Owner Based On Task Owner Before

Question asked by jakepens71 on Feb 20, 2015
Latest reply on Feb 27, 2015 by jakepens71
Hello,

I am running Alfresco 4.0.2 Enterprise.

I would I have three Tasks which are A, B, and C.

All three tasks are assigned to a pooled group. When the workflow gets to task B a member of that group claims the task. (Through the claim button on the workflow page.) Then after that user who claims the task rejects the workflow back to A which then will get sent back to B after A does what needs done.

Now, I would like the user who claimed task B BEFORE being sent to task A to be the owner of the task again AFTER it gets sent back to Task B.

I have tried doing something like this:

I wanted to create a process variable for it so I do this at the start. Is that right?

  var orderMatOwner = null;


then in my user task:


   <sequenceFlow id="flow3" name="Traveller Resubmitted" sourceRef="submitCPMTraveller" targetRef="orderMaterial"></sequenceFlow>
    <userTask id="orderMaterial" name="Order Materials" activiti:candidateGroups="GROUP_WF_CPMCustomerService" activiti:formKey="cpmwf:CPMOrdermaterial">
      <extensionElements>
        <activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
          <activiti:field name="script">
            <activiti:string>
                   <![CDATA[
                    if (typeof orderMatOwner != null) bpm_assignee = orderMatOwner) (also have tried task.owner, task.Owner, and task.getOwner)
                    execution.setVariable('cpmwf_previousComment', bpm_comment);
                    execution.setVariable('cpmwf_wfName', bpm_workflowDescription);
                    execution.setVariable('bpm_comment', bpm_comment);
                    if (typeof bpm_workflowDueDate != 'undefined') task.dueDate = bpm_workflowDueDate;
                    if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_workflowPriority;
                    ]]>
                    </activiti:string>
          </activiti:field>
        </activiti:taskListener>
        <activiti:taskListener event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
          <activiti:field name="script">
            <activiti:string><![CDATA[
                    execution.setVariable('orderMatOwner', bpm_assignee) (also have tried task.owner, task.Owner, and task.getOwner)
                    execution.setVariable('wf_reviewOutcome', task.getVariable('cpmwf_CPMorderMaterialOutcome'));
                    execution.setVariable('bpm_comment', task.getVariable('bpm_comment'));]]></activiti:string>
          </activiti:field>
        </activiti:taskListener>
      </extensionElements>
    </userTask>

Is this possible and if so can someone point me in the right direction please?

Thanks!

Outcomes