cancel
Showing results for 
Search instead for 
Did you mean: 

Setting mandatory task properties

chrisokelly
Champ on-the-rise
Champ on-the-rise
Hi,

I am working on a document expiry workflow that will send a reminder 2 weeks before a documents expiry date, give the option to extend the expiry and, if left till the expiry date, move content to an 'Expired' folder. (see my original post here). the actual behavior is yet to be added, right now I am just trying to test and validate the flow.

The issue I am having is that I have a mandatory property (expiryDate) defined as part of a custom type. I do not wish to have this property set on the start event, but rather the first task after the start event, which will be a pooled task assigned to a group. I gave this task a form key equal to my custom type and set up web-client-config-custom.xml (I haven't set up the share client customizations yet, I am just using alfresco to test so far) to display my property on nodes of that type, with the expectation that the workflow would start, assign a task to the group, I could take the task from the pool and set this property. However, instead, when I attempt to start the task I get a message - A system error happened during the operation: Exception while invoking TaskListener: 05260022 Mandatory task properties have not been provided! {my.company.workflow.root}expiryDate. The start event has no form key and should not require the property (if I correctly understand, which I guess I don't).
Is it required to set any mandatory properties used by any task in the workflow in the start event?

My web-client-config-custom.xml

<config evaluator="node-type" condition="mcwf:submitCorporateDocumentTask" replace="true">
      <property-sheet>
         <show-property name="mcwf:expiryDate" />
   </property-sheet>
   </config>


model.xml

<model name="mcwf:companyWorkflowModel" xmlns="http://www.alfresco.org/model/dictionary/1.0">
   <description>Company Workflow Model</description>
   <author>Chris O'Kelly</author>
   <version>1.0</version>
   
   <imports>
      <!– Import Alfresco Dictionary Definitions –>
      <import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
      <!– Import Alfresco Content Domain Model Definitions –>
      <import uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/>
      <!– Import Alfresco jBPM model definitions –>
      <import uri="http://www.alfresco.org/model/bpm/1.0" prefix="bpm" />
   </imports>
   
   <namespaces>
      <!– Define a namespace for the new definitions –>
      <namespace uri="my.Company.workflow.root" prefix="mcwf"/>
   </namespaces>
   
   <!– Constraints Definitions go here –>
   
   <!– Type Definitions go here –>
   <types>
      <type name="mcwf:submitHelloWorldTask">
         <parent>bpm:startTask</parent>
         <properties>
            <property name="mcwf:helloName">
               <type>d:text</type>
               <mandatory>true</mandatory>
               <multiple>false</multiple>
            </property>
         </properties>
      </type>
      <type name="mcwf:submitCorporateDocumentTask">
         <parent>bpm:startTask</parent>
         <mandatory-aspects>
            <aspect>mcwf:corporateDocumentExpiry</aspect>
         </mandatory-aspects>
      </type>
      
      <type name="mcwf:setNewExpiryDateTask">
         <properties>
            <property name="mcwf:newExpiryDate">
               <type>d:date</type>
               <mandatory>true</mandatory>
               <multiple>false</multiple>
            </property>
         </properties>
      </type>
      
      <type name="mcwf:corporateDocumentOutcomeTask">
         <parent>bpm:activitiOutcomeTask</parent>
         <properties>
            <property name="mcwf:extendExpireOutcome">
               <type>d:text</type>
               <default>Expire</default>
               <constraints>
                  <constraint type="LIST">
                     <parameter name="allowedValues">
                        <list>
                           <value>Extend</value>
                           <value>Expire</value>
                        </list>
                     </parameter>
                  </constraint>
               </constraints>
            </property>
         </properties>
         <overrides>
            <property name="bpm:packageItemActionGroup">
               <default>read_package_item_actions</default>
            </property>
            <property name="bpm:outcomePropertyName">
               <default>{my.Company.workflow.root}extendExpireOutcome</default>
            </property>
         </overrides>
      </type>
      
   </types>
   
   <!– Aspect Definitions go here –>
   <aspects>
      <aspect name="mcwf:corporateDocumentExpiry">
         <properties>
            <property name="mcwf:expiryDate">
               <type>d:date</type>
               <mandatory>true</mandatory>
               <multiple>false</multiple>
            </property>
            <property name="mcwf:reminderDate">
               <type>d:date</type>
               <multiple>false</multiple>
            </property>
         </properties>
      </aspect>
   </aspects>
</model>

the bpmn def
<?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://www.activiti.org/test">
  <process id="corporateDocumentExpiry" name="corporateDocumentExpiry">
    <startEvent id="startevent1" name="Start"></startEvent>
    <endEvent id="endevent1" name="End"></endEvent>
    <userTask id="alfrescoUsertask1" name="Set Expiration" activiti:candidateGroups="GROUP_Corporate" activiti:formKey="mcwf:setNewExpiryDateTask"></userTask>
    <userTask id="alfrescoUsertask2" name="2 week reminder" activiti:candidateGroups="GROUP_Corporate" activiti:formKey="mcwf:corporateDocumentOutcomeTask"></userTask>
    <boundaryEvent id="boundarytimer3" name="" cancelActivity="true" attachedToRef="alfrescoUsertask2">
      <timerEventDefinition>
        <timeDuration>20 minutes</timeDuration>
      </timerEventDefinition>
    </boundaryEvent>
    <exclusiveGateway id="exclusivegateway1" name="Exclusive Gateway"></exclusiveGateway>
    <serviceTask id="alfrescoScripttask1" name="Document Expires" activiti:class="org.alfresco.repo.workflow.activiti.script.AlfrescoScriptDelegate">
      <extensionElements>
        <activiti:field name="script">
          <activiti:string>logger.warn("Document Expired");</activiti:string>
        </activiti:field>
      </extensionElements>
    </serviceTask>
    <serviceTask id="alfrescoScripttask2" name="Set reminder date" activiti:class="org.alfresco.repo.workflow.activiti.script.AlfrescoScriptDelegate">
      <extensionElements>
        <activiti:field name="script">
          <activiti:string>logger.warn("Got to Set Reminder Date script task");</activiti:string>
        </activiti:field>
      </extensionElements>
    </serviceTask>
    <boundaryEvent id="boundarytimer2" name="" cancelActivity="false" attachedToRef="alfrescoScripttask2">
      <timerEventDefinition>
        <timeDuration>10 minutes</timeDuration>
      </timerEventDefinition>
    </boundaryEvent>
    <userTask id="usertask1" name="Set Expiration" activiti:candidateGroups="GROUP_Corporate" activiti:formKey="mcwf:submitCorporateDocumentTask"></userTask>
    <sequenceFlow id="flow2" name="" sourceRef="startevent1" targetRef="usertask1"></sequenceFlow>
    <sequenceFlow id="flow3" name="" sourceRef="exclusivegateway1" targetRef="alfrescoUsertask1">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[task.getVariableLocal('mcwf_approveRejectOutcome') == 'Extend']]></conditionExpression>
    </sequenceFlow>
    <sequenceFlow id="flow4" name="" sourceRef="alfrescoUsertask2" targetRef="exclusivegateway1"></sequenceFlow>
    <sequenceFlow id="flow5" name="" sourceRef="exclusivegateway1" targetRef="alfrescoScripttask1">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[task.getVariableLocal('mcwf_approveRejectOutcome') == 'Expire']]></conditionExpression>
    </sequenceFlow>
    <sequenceFlow id="flow6" name="" sourceRef="alfrescoScripttask1" targetRef="endevent1"></sequenceFlow>
    <sequenceFlow id="flow7" name="" sourceRef="alfrescoUsertask1" targetRef="alfrescoScripttask2"></sequenceFlow>
    <sequenceFlow id="flow8" name="" sourceRef="boundarytimer2" targetRef="alfrescoUsertask2"></sequenceFlow>
    <sequenceFlow id="flow9" name="" sourceRef="boundarytimer3" targetRef="alfrescoScripttask1"></sequenceFlow>
    <sequenceFlow id="flow10" name="" sourceRef="usertask1" targetRef="alfrescoScripttask2"></sequenceFlow>
  </process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_corporateDocumentExpiry">
    <bpmndi:BPMNPlane bpmnElement="corporateDocumentExpiry" id="BPMNPlane_corporateDocumentExpiry">
      <bpmndi:BPMNShape bpmnElement="startevent1" id="BPMNShape_startevent1">
        <omgdc:Bounds height="35" width="35" x="160" y="270"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="endevent1" id="BPMNShape_endevent1">
        <omgdc:Bounds height="35" width="35" x="1070" y="270"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="alfrescoUsertask1" id="BPMNShape_alfrescoUsertask1">
        <omgdc:Bounds height="55" width="105" x="366" y="178"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="alfrescoUsertask2" id="BPMNShape_alfrescoUsertask2">
        <omgdc:Bounds height="55" width="105" x="570" y="260"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="boundarytimer3" id="BPMNShape_boundarytimer3">
        <omgdc:Bounds height="30" width="30" x="608" y="302"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="exclusivegateway1" id="BPMNShape_exclusivegateway1">
        <omgdc:Bounds height="40" width="40" x="710" y="267"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="alfrescoScripttask1" id="BPMNShape_alfrescoScripttask1">
        <omgdc:Bounds height="55" width="105" x="930" y="260"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="alfrescoScripttask2" id="BPMNShape_alfrescoScripttask2">
        <omgdc:Bounds height="55" width="105" x="366" y="260"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="boundarytimer2" id="BPMNShape_boundarytimer2">
        <omgdc:Bounds height="30" width="30" x="460" y="273"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="usertask1" id="BPMNShape_usertask1">
        <omgdc:Bounds height="55" width="105" x="220" y="260"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2">
        <omgdi:waypoint x="195" y="287"></omgdi:waypoint>
        <omgdi:waypoint x="220" y="287"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow3" id="BPMNEdge_flow3">
        <omgdi:waypoint x="730" y="267"></omgdi:waypoint>
        <omgdi:waypoint x="729" y="205"></omgdi:waypoint>
        <omgdi:waypoint x="471" y="205"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow4" id="BPMNEdge_flow4">
        <omgdi:waypoint x="675" y="287"></omgdi:waypoint>
        <omgdi:waypoint x="710" y="287"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow5" id="BPMNEdge_flow5">
        <omgdi:waypoint x="750" y="287"></omgdi:waypoint>
        <omgdi:waypoint x="930" y="287"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow6" id="BPMNEdge_flow6">
        <omgdi:waypoint x="1035" y="287"></omgdi:waypoint>
        <omgdi:waypoint x="1070" y="287"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow7" id="BPMNEdge_flow7">
        <omgdi:waypoint x="418" y="233"></omgdi:waypoint>
        <omgdi:waypoint x="418" y="260"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow8" id="BPMNEdge_flow8">
        <omgdi:waypoint x="475" y="303"></omgdi:waypoint>
        <omgdi:waypoint x="570" y="287"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow9" id="BPMNEdge_flow9">
        <omgdi:waypoint x="623" y="332"></omgdi:waypoint>
        <omgdi:waypoint x="622" y="371"></omgdi:waypoint>
        <omgdi:waypoint x="982" y="371"></omgdi:waypoint>
        <omgdi:waypoint x="982" y="315"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow10" id="BPMNEdge_flow10">
        <omgdi:waypoint x="325" y="287"></omgdi:waypoint>
        <omgdi:waypoint x="366" y="287"></omgdi:waypoint>
        <bpmndi:BPMNLabel>
          <omgdc:Bounds height="14" width="100" x="10" y="0"></omgdc:Bounds>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</definitions>
1 REPLY 1

chrisokelly
Champ on-the-rise
Champ on-the-rise
In case anyone else has the issue of needing to make a workflow task form property mandatory without throwing errors when the task is started, this was actually a really simple fix. I removed the mandatory element from the workflow model and set the field to be mandatory in the share-config-custom.xml file.