Workflow "if" core activity with multiple conditions not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-06-2020 09:10 AM
I am developing a workflow that uses an "If" statement block with multiple conditions; each condition represents a checkbox variable, and the "checked" condition should return true, thus firing off its respective workflow. Unfortunately, I am having trouble getting this to work properly.
Currently, I have a "run script" pushing the values of each checkbox variable to the workflow.scratchpad in a string. Next, the workflow fires off from the "run script" to the "If" block, where each conditions looks to see if a value exists for its corresponding variable (ex.: String(workflow.scratchpad.trigger).indexOf("workersComp)!=-1).
Unfortunately, the workflow will always simultaneously fire off the workflows for "promotion", "workers comp", "demotion", "paychange" and "termination", no matter which checkbox I select. What am I doing wrong? Any feedback is greatly appreciated. Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-30-2020 06:02 AM
I think I found my own answer. Looks like the answer is you cannot have more than 'yes' and 'no' and only 'yes' or 'no'.
https://docs.servicenow.com/bundle/paris-servicenow-platform/page/administer/workflow-activities/reference/r_If.html
So I did a run script that sets workflow.scratchpad.myThing to one of my values, like what I was doing in the original IF activity. Then I pointed that to a Branch activity (I believe this requires a Join activity sometime later).
In the Branch activity I just added the conditions there like I was trying with the IF activity (workflow.scratchpad.myThing == 'missing_approvers').
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-30-2020 06:38 AM
Hi,
Yes, that's correct. For IF activity, you can not have more outputs than just yes and no. You'd want to use a run script activity to allow for multiple outputs 🙂
Please mark reply as Helpful, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
