6.4.x: How to correctly use path selection with an OR Split?
AEM site setup:
4 sites have been setup in /content.
- /content/site1/en
- /content/site2/en
- /content/site3/en
- /content/site4/en
---------------------------------
So I was reading this guide/example (Creating Workflow Models ) on how to setup path selection on an OR Split.
Using this example, I create 4-branch OR Split and each branch having its own script (see below for code).
My problem is that the path selection is not working properly.
tests I've done:
- I request for publication a page in /content/site3/en and the notification email that I received says "Step: Email site2 admin"
- I request for publication a page in /content/site2/en and the notification email says it's from site3
- I request for publication a page in /content/site1/en and the notification email says it's from site3.
Any ideas what I could be doing wrong? Thanks
------------
Workflow screenshot showing the Or Split + the participant steps for each branch: https://i.imgur.com/10SUSCX.png
-------------
branch1 script
function check() {
if (workflowData.getPayloadType() == "JCR_PATH") {
var path = workflowData.getPayload().toString();
var node = jcrSession.getItem(path);
if (node.getPath().indexOf("/content/site1/en") != -1) {
return true;
}
}
return false;
}
-------------
branch2 script
function check() {
if (workflowData.getPayloadType() == "JCR_PATH") {
var path = workflowData.getPayload().toString();
var node = jcrSession.getItem(path);
if (node.getPath().indexOf("/content/site2/en") != -1) {
return true;
}
}
return false;
}
-------------
branch3 script
function check() {
if (workflowData.getPayloadType() == "JCR_PATH") {
var path = workflowData.getPayload().toString();
var node = jcrSession.getItem(path);
if (node.getPath().indexOf("/content/site3/en") != -1) {
return true;
}
}
return false;
}
-------------
branch4 script
function check() {
if (workflowData.getPayloadType() == "JCR_PATH") {
var path = workflowData.getPayload().toString();
var node = jcrSession.getItem(path);
if (node.getPath().indexOf("/content/site4/en") != -1) {
return true;
}
}
return false;
}
-------------