Example for CreateWorkItem Activity
The following example evaluates participants based on a Business Process Rule, Import Approval, and creates work items in the Inbox of those users.
The work item expires after one day, in case the user does not approve or reject it within that time.
<Activity Name="ImportApprovalWorkitem"> <Description lang="en">Create a workitem for import approval</Description> <Execution>SYNCHR</Executionn> <Parameter direction="in" type="string" eval="constant" name="eventState">IMPORTAPPROVALWORKITEM</Parameter> <Parameter direction="in" name="Intent" eval="constant" type="string">Approval</Parameter> <Parameter direction="in" name="ReferenceStepID" eval="variable" type="long">pl2</Parameter> <Parameter direction="in" eval="rule" source="Import Approval" type="long" name="ParticipantID">workDoc</Parameter> <Parameter direction="in" eval="rule" source="Master Catalog Import Approval" type="string" name="ParticipantType">workDoc</Parameter> <Parameter direction="in" eval="constant" type="string" name="FormPresentation"> com.tibco.mdm.ui.workflow.engine.workitem.templates.CatalogImportApproval</Parameter> <Parameter direction="in" eval="constant" type="string" name="TaskType">CATALOGIMPORTRECORD</Parameter> <Parameter direction="in" eval="variable" type="document" name="InDocument">workDoc</Parameter> <Parameter direction="in" eval="constant" type="string" name="ExpiryType">RELATIVE</Parameter> <Parameter direction="in" eval="constant" type="string" name="ExpiryDate">1:0:0:0</Parameter> <Parameter direction="out" eval="variable" type="document" name="OutDocument">wiDoc</Parameter> <Parameter direction="out" eval="variable" type="boolean" name="WorkItemCreated">approvalFlag</Parameter> <Parameter direction="out" eval="variable" type="boolean" name="MergedDocument">workDoc</Parameter> <Parameter direction="out" name="StepID" eval="variable" type="long">pl1</Parameter> </Activity>
Based on the output from activity, loop through the ImportApprovalWorkitem activity till all work items are approved or one of them is rejected.
<Transition FromActivity="ImportApprovalWorkitem" ToActivity="ImportApprovalWorkitem"> <Description lang="en">Test that all created Import Master Catalog approval workitems have been completed or someone has rejected workitem.</Description> <Rule> <Parameter name="wicreated" type="boolean" eval="variable" direction="in">approvalFlag</Parameter> <Parameter name="numberCreated" type="long" eval="variable" direction="in">NumberCreated</Parameter> <Parameter name="numberCompleted" type="long" eval="variable" direction="in">NumberCompleted</Parameter> <Parameter name="response" type="string" eval="variable" direction="in">FormResult</Parameter> <Parameter name="result" type="boolean" direction="out" /> <Condition format="bsh"> <![CDATA[ result = ((wicreated) && (numberCompleted < numberCreated) && (!((response != null) && (response.equalsIgnoreCase("Reject"))))); System.out.println("Transition ImportMasterCatalogInternalApprovalWorkitem to ImportMasterCatalogInternalApprovalWorkitem result - " + result + " Created = " + numberCreated + " Completed = " + numberCompleted + " Response = " + response); </Condition> </Rule> </Transition>
Copyright © Cloud Software Group, Inc. All rights reserved.