OR Split in Workflow in AEM 6.5
The OR Split creates a split in the workflow, after which only one branch will be active. This step enables you to introduce conditional processing paths into your workflow. You add workflow steps to each branch as required.
OR Split – Configuration
Common Tab :
- In this tab, only one property will be display :
- Split Name – Give the name to your split.
Branches Tab :
- In this tab, By default two branches will be display. We can also add more branches by clicking on Add Branch :
We can add multiple branches here but only one branch will be execute among them.
In every branch firstly we need to Select a Routing Expression like as : Rule Definition, External Script or ECMA Script.
Rule Definition : In Rule Definition, We need to set variables by Set Variable step. And after that we can give conditions in Rule Definition at basis of these variables.
External Script : In External Script, We need to give the path of an external script (ECMA Script) which is saved at the following path –
apps > workflow > scripts > test.ecma
ECMA Script : In ECMA Script, We need to write our ECMAscript in Script section of every branch. In this script we write a check function which will return true or false at the basis of condition. In which branch it returns true that branch will be executed. (But only one branch will be execute)
function check(){
var map = workflowData.getMetaDataMap();
var approval = map.get(“reviewApproval”);
return (approval == “approve”);
}
- Default Route: The default branch is followed in case of multiple branches. You can specify only one branch as the default. When no branch returns true, In this case default route branch will be execute.
Here, we create a OR Split on the basis of dailog’s value which is saved at metadata node of workflow.
First we get metaDataMap by workflowData object.
(Note : In OR and And Split default object becomes change like : In these Splits we have workflowData object instead of graniteWorkItem object)
Then get our value from this map, after that we return true or false at the basis of this value.
For Branch 2 we give the same condition with negation which returns true or false.
Here, if dialog’s value is “approve” then first branch will be execute else if dialog’s value is “reject” then second branch will be execute.
By Shadan
Recent Comments