Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Understanding how OR Split in workflow works

Avatar

Avatar
Validate 1
Level 2
anands82757572
Level 2

Likes

4 likes

Total Posts

18 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 3
Boost 1
View profile

Avatar
Validate 1
Level 2
anands82757572
Level 2

Likes

4 likes

Total Posts

18 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 3
Boost 1
View profile
anands82757572
Level 2

10-05-2018

I am having some troubles understanding how the OR split works.

I have a workflow model that is supposed to do the following:

1. Check if page is valid

2. If yes

          2a. Deactive page

          2b. Move and Archive page, more like a soft delete of content

          2c. Notification email

3. If No

          3a. Notification email

In Step 1, I set the following key/value pair:

item.getWorkflowData().getMetaDataMap().put("IsValid", String.valueOf(isValidContent));

In the OR condition, I have this in the ecma script for Batch 1:

function check() {

var isValidContent = graniteWorkItem.getWorkflowData().getMetaDataMap().get("IsValid");

log.info("isValidContent = "+isValidContent);

if (isValidContent === "true"){

return true;

}else{

return false;

}

}

What does this mean? Branch 1 will be triggered when check() returns true and Branch 2 for all false? What should the check() condition in Branch 2 return? I am a bit lost and need some help on this to understand how the split works.

Thanks,

Anand

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,345 likes

Total Posts

3,220 posts

Correct Reply

914 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,345 likes

Total Posts

3,220 posts

Correct Reply

914 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile
Arun_Patidar
MVP

10-05-2018

Only a single branch can run, if it return true. If no branch returns true then it will go to the default route if one is set, otherwise the OR Split will error.

for Branch2 you need to write like below or set one of them as Default route

if (isValidContent !== "true"){

return true;

}

This should work!

Thanks

Arun

Answers (3)

Answers (3)

Avatar

Avatar
Boost 5
Level 2
evancooperman-s
Level 2

Likes

5 likes

Total Posts

6 posts

Correct Reply

1 solution
Top badges earned
Boost 5
Boost 3
Validate 1
Affirm 1
Boost 1
View profile

Avatar
Boost 5
Level 2
evancooperman-s
Level 2

Likes

5 likes

Total Posts

6 posts

Correct Reply

1 solution
Top badges earned
Boost 5
Boost 3
Validate 1
Affirm 1
Boost 1
View profile
evancooperman-s
Level 2

28-08-2018

This is what I thought too, but even when I set default route for 1 branch, and both branches return false, it throws an exception that it doesn't know which route to take.   I believe the default route will only be used if both branches return true, not if they both return false.  A branch returning false means it's not a viable branch, so if both branches return false then AEM doesn't think either branch is viable.

Avatar

Avatar
Validate 1
Level 2
antond26624417
Level 2

Likes

4 likes

Total Posts

10 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 3
Boost 1
Applaud 5
View profile

Avatar
Validate 1
Level 2
antond26624417
Level 2

Likes

4 likes

Total Posts

10 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 3
Boost 1
Applaud 5
View profile
antond26624417
Level 2

19-06-2019

@evancooperman-smith  I think your answer is more like true. This is what exactly officially documented.
Workflow Step Reference

Avatar

Avatar
Validate 1
Level 2
anands82757572
Level 2

Likes

4 likes

Total Posts

18 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 3
Boost 1
View profile

Avatar
Validate 1
Level 2
anands82757572
Level 2

Likes

4 likes

Total Posts

18 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 3
Boost 1
View profile
anands82757572
Level 2

10-05-2018

Thank you Arun!!