Friday, April 22, 2016

How to add custom transitions in the activiti workflow?

How to add custom transitions in the activiti workflow?

I will show you, how we can display our custom transitions in the Alfresco Activiti workflow.



Step 1: Add the new transitions in your workflow model as mentioned below.

Custom Review Task
<type name="someco:customReviewTask">
<title>Custom Review Task</title>
<parent>bpm:activitiOutcomeTask</parent>
<properties>
<property name="someco:customReviewOutcome">
<type>d:text</type>
<default>Review</default>
<constraints>
<constraint name="someco:customReviewOutcomeOptions" type="LIST">
<parameter name="allowedValues">
<list>
<value>Approve</value>
<value>Reject</value>
<value>Review</value> 
</list>
</parameter>
</constraint>
</constraints>
</property>
</properties>
<overrides>
<property name="bpm:packageItemActionGroup">
<default>edit_package_item_actions</default>
</property>
<property name="bpm:outcomePropertyName">
<default>{someco.workflowModel}customReviewOutcome</default>
</property>
</overrides>
</type>

Step 2: Add the new transition field in the share-custom-config.xml file.
<config evaluator="task-type" condition="someco:customReviewTask">
<forms>
<form>
<field-visibility>
<show id="message" />
<show id="taskOwner" />
<show id="bpm:priority" />
<show id="bpm:dueDate" />
<show id="bpm:taskId" />
<show id="bpm:status" />
<show id="packageItems" />
<show id="bpm:comment" />
<show id="someco:customReviewOutcome" />

</field-visibility>
<appearance>
<set id="" appearance="title" label-id="workflow.set.task.info" />
<set id="info" appearance="" template="/org/alfresco/components/form/3-column-set.ftl" />
<set id="progress" appearance="title" label-id="workflow.set.task.progress" />
<set id="items" appearance="title" label-id="workflow.set.items" />
<set id="response" appearance="title" label-id="workflow.set.response" />
<field id="message">
<control template="/org/alfresco/components/form/controls/info.ftl" />
</field>
<field id="taskOwner" set="info" />
<field id="bpm:taskId" set="info">
<control template="/org/alfresco/components/form/controls/info.ftl" />
</field>
<field id="bpm:priority" set="info" read-only="true">
<control template="/org/alfresco/components/form/controls/workflow/priority.ftl" />
</field>
<field id="bpm:dueDate" set="info" label-id="workflow.field.due">
<control template="/org/alfresco/components/form/controls/info.ftl" />
</field>
<field id="bpm:status" set="progress" />
<field id="packageItems" set="items" />
<field id="bpm:comment" label-id="workflow.field.comment" set="response">
<control template="/org/alfresco/components/form/controls/textarea.ftl" />
</field>
<field id="someco:customReviewOutcome" label-id="workflow.field.outcome" set="response">
<control template="/org/alfresco/components/form/controls/workflow/activiti-transitions.ftl" />
</field>
</appearance>
</form>
</forms>
</config>


Step 3: In the activiti workflow, you should refer, "someco:customReviewTask" as the form key.

No comments:

Post a Comment