cancel
Showing results for 
Search instead for 
Did you mean: 

Share Worflow - Reusing bpm:assignee

ncunha
Champ in-the-making
Champ in-the-making
Hello.

I'm new to the Alfresco platform and I'm having a problem when I run my advanced workflow on Share.
My process is very simple: Start (Task 0) -> Task 1 -> Task 2 -> Task 3 -> End.
I want all the Tasks to be possibly ran by different users and the user of the current task chooses who'll run the next task.
I'm using the bpm:assignee as a mandatory aspect on every task for the user to be able to set the next assigned user.

The problem happens when running the Workflow on Share, on "Task 1" with the second user. After setting the third user to be assigned to the "Task 2" I get the message "java.lang.ClassCastException: org.alfresco.service.cmr.repository.NodeRef cannot be cast to java.util.List" when I click the button to advance to the next task. If I don't assign a different user, the process advances as expected and the next Task is assigned to the current user.
The error message seems to be caused or at least related to using bpm:assignee on a second new user because the process runs just fine the first time the bpm:assignee is first used, from "Task 0" to "Task 1".
Also, this problem doesn't happen when running the workflow on the Explorer, it only happens on Share.

Thanks in advance.

Regards,
Nélson Cunha.
8 REPLIES 8

gavinc
Champ in-the-making
Champ in-the-making
Could you post a few more details? For example your task model, process definition and form configuration.

It would also be really useful if you could post the HTTP request getting sent when you click the transition button.

ncunha
Champ in-the-making
Champ in-the-making
Hi there.
Thanks for your quick response.

Here's the XHR:
Request URL:http://localhost:8080/share/proxy/alfresco/api/task/jbpm$5/formprocessor
Request MethodSmiley TongueOST
Status Code:500 Internal Server Error

Request Headers
Content-Type:application/json; charset=UTF-8
Origin:http://localhost:8080
Referer:http://localhost:8080/share/page/user/editor/task-edit?taskId=jbpm$5&referrer=tasks
User-Agent:Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/534.3 (KHTML, like Gecko) Chrome/6.0.472.55 Safari/534.3
X-Requested-With:application/x-www-form-urlencoded

Request Payload
{"assoc_bpm_assignee_added":"workspace://SpacesStore/6b4a44fd-da87-4d5b-bb1e-79f07797cdc0","assoc_bpm_assignee_removed":"workspace://SpacesStore/e897752a-4194-4585-8ecf-2631ae9454c2","prop_bpm_description":"Workflow C - another test","prop_bpm_comment":"","prop_bpm_dueDate":"","prop_bpm_percentComplete":"0","prop_bpm_priority":"3","prop_bpm_status":"Not Yet Started","prop_transitions":"Done","assoc_packageItems_added":"","assoc_packageItems_removed":""}

Response Headers
Cache-Control:no-cache
Connection:close, close
Content-Length:465
Content-Type:application/json;charset=UTF-8
Date:Fri, 10 Dec 2010 10:06:18 GMT
Pragma:no-cache
Server:Apache-Coyote/1.1

Also here's the Workflow: http://www.filedropper.com/share-workflow-workflowc

gavinc
Champ in-the-making
Champ in-the-making
Thanks for the details, I have managed to reproduce your issue and found a bug which I have raised here: http://issues.alfresco.com/jira/browse/ALF-6133

I will fix this next week.

ncunha
Champ in-the-making
Champ in-the-making
Thank you very much for your quick support.
I'll be looking forward for the fix.

Best regards,
Nélson Cunha.

gavinc
Champ in-the-making
Champ in-the-making
As you may or may not have seen ALF-6133 was resolved yesterday and I've made sure that you use case works as expected.

The fix is in the forthcoming 3.4 enterprise release branch at the moment, I will however, merge this to HEAD soon so that it is in the 3.4.c community release too.

anunofreitas
Champ in-the-making
Champ in-the-making
Sorry to dig up this thread but I have the same objective that Nélson Cunha, that is to have a few tasks that the next assignee is defined by the actual assignee.

I am using the 4.0.c comunity version , and if the assigne doesn't change nothing wrong happens, but if I try to change, on share I get the "java.lang.ClassCastException: org.alfresco.service.cmr.repository.NodeRef cannot be cast to java.util.List" when submiting the task done button or save changes.

I can change the assign the bpm if I use
 execution.setVariable('bpm_assignee', "User name or Variable with a user");

But can't change if I use the user picker that I found on the other workflows.I use the user picket the following way:
 <forms>
                        <form>
                                <field-visibility>
                                           …
                                        <show id="bpm:assignee" />

                                </field-visibility>
                                <appearance>
                                           …
                                        <set id="assignee" appearance="title" label-id="workflow.set.assignee" />
                                           …
                                        <field id="bpm:assignee" label-id="workflow.field.assign_to"
                                                set="assignee" />
                                           …
                                </appearance>
                        </form>
                </forms>

The workflow definition
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://activiti.org/bpmn20">
  <process id="docElaboracao" name="Elaboração de Documentos">
    <startEvent id="start" name="Start" activiti:formKey="wf:submitDocElaboracao"></startEvent>
    <userTask id="elaboracao" name="Elaboração" activiti:dueDate="${bpm_workflowDueDate}" activiti:assignee="${bpm_assignee.properties.userName}" activiti:formKey="wf:elaboracao">
      <extensionElements>
        <activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
          <activiti:field name="script">
            <activiti:string>if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_workflowPriority;
if (typeof bpm_comment != 'undefined') task.setVariable('bpm_comment', bpm_comment);</activiti:string>
          </activiti:field>
        </activiti:taskListener>
<activiti:taskListener event="assignment" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
          <activiti:field name="script">
            <activiti:string>execution.setVariable('bpm_assignee', task.getVariable('bpm_assignee'));
</activiti:string>
          </activiti:field>
        </activiti:taskListener>
        <activiti:taskListener event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
          <activiti:field name="script">
            <activiti:string>
execution.setVariable('bpm_comment', task.getVariable('bpm_comment'));
execution.setVariable('wf_developer', person);
execution.setVariable('bpm_dueDate', task.dueDate);
execution.setVariable('bpm_priority', task.priority);
</activiti:string>
          </activiti:field>
        </activiti:taskListener>
      </extensionElements>
    </userTask>
    <userTask id="verificacao" name="Verificação" activiti:dueDate="${bpm_workflowDueDate}" activiti:assignee="${bpm_assignee.properties.userName}" activiti:formKey="wf:verificacao">
      <extensionElements>
        <activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
          <activiti:field name="script">
            <activiti:string>if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_workflowPriority;
if (typeof bpm_comment != 'undefined') task.setVariable('bpm_comment', bpm_comment);</activiti:string>
          </activiti:field>
        </activiti:taskListener>
        <activiti:taskListener event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
          <activiti:field name="script">
            <activiti:string>execution.setVariable('bpm_assignee', task.getVariable('bpm_assignee'));
execution.setVariable('bpm_comment', task.getVariable('bpm_comment'));
execution.setVariable('bpm_dueDate', task.dueDate);
execution.setVariable('bpm_priority', task.priority);
execution.setVariable('wf_reviewOutcome', task.getVariable('wf_reviewOutcome'));</activiti:string>
          </activiti:field>
        </activiti:taskListener>
      </extensionElements>
    </userTask>
    <userTask id="aprovacao" name="Aprovação" activiti:dueDate="${bpm_workflowDueDate}" default="flow9" activiti:assignee="${bpm_assignee.properties.userName}" activiti:formKey="wf:aprovacao">
<extensionElements>
        <activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
          <activiti:field name="script">
            <activiti:string>if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_workflowPriority;
if (typeof bpm_comment != 'undefined') task.setVariable('bpm_comment', bpm_comment);</activiti:string>
          </activiti:field>
        </activiti:taskListener>
        <activiti:taskListener event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
          <activiti:field name="script">
            <activiti:string>execution.setVariable('bpm_comment', task.getVariable('bpm_comment'));
execution.setVariable('bpm_dueDate', task.dueDate);
execution.setVariable('bpm_priority', task.priority);
execution.setVariable('wf_reviewOutcome', task.getVariable('wf_reviewOutcome'));</activiti:string>
          </activiti:field>
        </activiti:taskListener>
      </extensionElements>
    </userTask>
    <exclusiveGateway id="exclusivegateway1" name="Exclusive Gateway"></exclusiveGateway>
    <exclusiveGateway id="exclusivegateway2" name="Exclusive Gateway"></exclusiveGateway>
    <sequenceFlow id="flow1" name="" sourceRef="start" targetRef="elaboracao"></sequenceFlow>
    <sequenceFlow id="flow2" name="" sourceRef="elaboracao" targetRef="verificacao"></sequenceFlow>
    <sequenceFlow id="flow3" name="" sourceRef="verificacao" targetRef="exclusivegateway1"></sequenceFlow>
    <sequenceFlow id="flow4" name="" sourceRef="exclusivegateway1" targetRef="aprovacao">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${wf_reviewOutcome == 'Approve'}]]></conditionExpression>
    </sequenceFlow>
    <sequenceFlow id="flow5" name="" sourceRef="exclusivegateway1" targetRef="elaboracao">
      <extensionElements>
        <activiti:executionListener event="take" class="org.alfresco.repo.workflow.activiti.listener.ScriptExecutionListener">
          <activiti:field name="script">
            <activiti:string>execution.setVariable('bpm_assignee', task.getVariable('wf_developer'));</activiti:string>
          </activiti:field>
        </activiti:executionListener>
      </extensionElements>
    </sequenceFlow>
    <sequenceFlow id="flow6" name="" sourceRef="aprovacao" targetRef="exclusivegateway2"></sequenceFlow>
    <userTask id="aprovado" name="Elaboração Aprovada" activiti:assignee="${initiator.exists() ? initiator.properties.userName : 'admin'}" activiti:formKey="wf:aprovado">
      <extensionElements>
        <activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
          <activiti:field name="script">
            <activiti:string>if (typeof bpm_comment != 'undefined') task.setVariable('bpm_comment', bpm_comment);</activiti:string>
          </activiti:field>
        </activiti:taskListener>
      </extensionElements>
    </userTask>
    <sequenceFlow id="flow9" name="" sourceRef="exclusivegateway2" targetRef="aprovado">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${wf_reviewOutcome == 'Approve'}]]></conditionExpression>
    </sequenceFlow>
    <sequenceFlow id="flow10" name="" sourceRef="exclusivegateway2" targetRef="elaboracao">
      <extensionElements>
        <activiti:executionListener event="take" class="org.alfresco.repo.workflow.activiti.listener.ScriptExecutionListener">
          <activiti:field name="script">
<activiti:string>execution.setVariable('bpm_assignee', task.getVariable('wf_developer'));</activiti:string>
          </activiti:field>
        </activiti:executionListener>
      </extensionElements>
    </sequenceFlow>
    <endEvent id="end" name="End"></endEvent>
    <sequenceFlow id="flow11" name="" sourceRef="aprovado" targetRef="end"></sequenceFlow>
</process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_docElaboracao">
    <bpmndi:BPMNPlane bpmnElement="docElaboracao" id="BPMNPlane_docElaboracao">
      <bpmndi:BPMNShape bpmnElement="start" id="BPMNShape_start">
        <omgdc:Bounds height="35" width="35" x="110" y="170"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="elaboracao" id="BPMNShape_elaboracao">
        <omgdc:Bounds height="55" width="105" x="220" y="160"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="verificacao" id="BPMNShape_verificacao">
        <omgdc:Bounds height="55" width="105" x="400" y="160"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="aprovacao" id="BPMNShape_aprovacao">
        <omgdc:Bounds height="55" width="105" x="580" y="160"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="exclusivegateway1" id="BPMNShape_exclusivegateway1">
        <omgdc:Bounds height="40" width="40" x="432" y="70"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="exclusivegateway2" id="BPMNShape_exclusivegateway2">
        <omgdc:Bounds height="40" width="40" x="612" y="280"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="aprovado" id="BPMNShape_aprovado">
        <omgdc:Bounds height="55" width="105" x="790" y="160"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="end" id="BPMNShape_end">
        <omgdc:Bounds height="35" width="35" x="950" y="170"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="flow1" id="BPMNEdge_flow1">
        <omgdi:waypoint x="145" y="187"></omgdi:waypoint>
        <omgdi:waypoint x="220" y="187"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2">
        <omgdi:waypoint x="325" y="187"></omgdi:waypoint>
        <omgdi:waypoint x="400" y="187"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow3" id="BPMNEdge_flow3">
        <omgdi:waypoint x="452" y="160"></omgdi:waypoint>
        <omgdi:waypoint x="452" y="110"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow4" id="BPMNEdge_flow4">
        <omgdi:waypoint x="472" y="90"></omgdi:waypoint>
        <omgdi:waypoint x="632" y="90"></omgdi:waypoint>
        <omgdi:waypoint x="632" y="160"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow5" id="BPMNEdge_flow5">
        <omgdi:waypoint x="432" y="90"></omgdi:waypoint>
        <omgdi:waypoint x="272" y="90"></omgdi:waypoint>
        <omgdi:waypoint x="272" y="160"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow6" id="BPMNEdge_flow6">
        <omgdi:waypoint x="632" y="215"></omgdi:waypoint>
        <omgdi:waypoint x="632" y="280"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow9" id="BPMNEdge_flow9">
        <omgdi:waypoint x="652" y="300"></omgdi:waypoint>
        <omgdi:waypoint x="842" y="299"></omgdi:waypoint>
        <omgdi:waypoint x="842" y="215"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow10" id="BPMNEdge_flow10">
        <omgdi:waypoint x="612" y="300"></omgdi:waypoint>
        <omgdi:waypoint x="272" y="300"></omgdi:waypoint>
        <omgdi:waypoint x="272" y="215"></omgdi:waypoint>
</bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow10" id="BPMNEdge_flow10">
        <omgdi:waypoint x="612" y="300"></omgdi:waypoint>
        <omgdi:waypoint x="272" y="300"></omgdi:waypoint>
        <omgdi:waypoint x="272" y="215"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow11" id="BPMNEdge_flow11">
        <omgdi:waypoint x="895" y="187"></omgdi:waypoint>
        <omgdi:waypoint x="950" y="187"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</definitions>

The model
<type name="wf:submitDocElaboracao">
                <parent>bpm:startTask</parent>
                <mandatory-aspects>
                        <aspect>bpm:assignee</aspect>
                </mandatory-aspects>
        </type>

      <type name="wf:elaboracao">
         <parent>bpm:workflowTask</parent>
                <mandatory-aspects>
                        <aspect>bpm:assignee</aspect>
                </mandatory-aspects>
      </type>

        <type name="wf:verificacao">
            <parent>wf:activitiReviewTask</parent>
                 <mandatory-aspects>
                        <aspect>bpm:assignee</aspect>
                </mandatory-aspects>
        </type>

        <type name="wf:aprovacao">
            <parent>wf:activitiReviewTask</parent>
        </type>

      <type name="wf:aprovado">
         <parent>bpm:workflowTask</parent>
      </type>


Am I doing anything wrong???
If necessary I will post the share form config.
Thank you

kishor_gandham
Champ in-the-making
Champ in-the-making
I have the exact same issue in Alfresco 4.0.d community edition. Can anyone please help? Is there any workaround?

Thanks,
Kishor

lyles
Champ in-the-making
Champ in-the-making
I'm also seeing the same error in Alfresco 4.0.d CE.
In my case, I have a revise/resubmit task that allows changing the bpm:assignee association.
If I don't change it, the revise task completes successfully.
If I do change it, the revise task fails with the NodeRef cannot be cast to java.util.List error

The workflow was developed on 4.2.e CE and works fine there, successfully updating the bpm:assignee association when it is changed in the form.

Anyone know of a fix or workaround for 4.0.d?
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.