AnsweredAssumed Answered

[SOLVED] No startTask description to userTask message copy

Question asked by mrvanes on Apr 17, 2012
Hi,

I've been struggling to create a custom workflow in Alfresco 4.0.a the past couple of days and have come a long way, thanks to many well documented examples and howto's! Now I'm banging my head against the wall because I don't seem to be able to transfer the bpm_workflowDescription and bpm_workflowDueDate to the next (alfresco)userTask. I'm using the default wf model/namespace to make sure I'm not introducing model mistakes.

If I start the (default) activiti$reviewTask the message is transferred to the next userTask. In my case, the Message value becomes "Review".

Here's the (very simple) workflow:

<?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="reviewTest" name="Review Test">
    <startEvent id="Start" name="start" activiti:formKey="wf:submitReviewTask"></startEvent>
    <userTask id="alfrescoUsertask1" name="Alfresco User Task" activiti:assignee="${bpm_assignee.properties.userName}" activiti:formKey="wf:activitiReviewTask">
      <documentation>Review</documentation>
      <extensionElements>
        <activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
          <activiti:field name="script">
            <activiti:string>if (typeof bpm_workflowDueDate != 'undefined') task.setVariableLocal('bpm_dueDate', bpm_workflowDueDate);
if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_workflowPriority;</activiti:string>
          </activiti:field>
        </activiti:taskListener>
      </extensionElements>
    </userTask>
    <endEvent id="end" name="End"></endEvent>
    <sequenceFlow id="flow1" name="" sourceRef="Start" targetRef="alfrescoUsertask1"></sequenceFlow>
    <sequenceFlow id="flow2" name="" sourceRef="alfrescoUsertask1" targetRef="end"></sequenceFlow>
  </process>
</definitions>

I added a copy of activiti@reviewTask with changed condition form for the new workflow to share-config-custom.xml

   <config evaluator="string-compare" condition="activiti$reviewTest">
      <forms>
         <form>
            <field-visibility>
               <show id="bpm:workflowDescription" />
               <show id="bpm:workflowDueDate" />
               <show id="bpm:workflowPriority" />
               <show id="bpm:assignee" />
               <show id="packageItems" />
               <show id="bpm:sendEMailNotifications" />
            </field-visibility>
            <appearance>
               <set id="" appearance="title" label-id="workflow.set.general" />
               <set id="info" appearance="" template="/org/alfresco/components/form/2-column-set.ftl" />
               <set id="assignee" appearance="title" label-id="workflow.set.assignee" />
               <set id="items" appearance="title" label-id="workflow.set.items" />
               <set id="other" appearance="title" label-id="workflow.set.other" />
              
               <field id="bpm:workflowDescription" label-id="workflow.field.message">
                  <control template="/org/alfresco/components/form/controls/textarea.ftl">
                     <control-param name="style">width: 95%</control-param>
                  </control>
               </field>
               <field id="bpm:workflowDueDate" label-id="workflow.field.due" set="info" />
               <field id="bpm:workflowPriority" label-id="workflow.field.priority" set="info">
                  <control template="/org/alfresco/components/form/controls/workflow/priority.ftl" />
               </field>
               <field id="bpm:assignee" label-id="workflow.field.reviewer" set="assignee" />
               <field id="packageItems" set="items" />
               <field id="bpm:sendEMailNotifications" set="other">
                  <control template="/org/alfresco/components/form/controls/workflow/email-notification.ftl" />
               </field>
            </appearance>
         </form>
      </forms>
   </config>

Pff… ok, so describing your problem sometimes helps finding the solution. I just discovered that adding a <documentation> element to custom workflow disrupts the transfer of bpm_workflowDescription to the userTask message field. Removing the element in the workflow correctly copies the description (message) from the startTask now. I consider this very, very, very unexpected behaviour!

I'll leave this topic for those banging their heads to the same wall.

Martin

Outcomes