- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2014 11:39 AM
Hi ServiceNow people!
I want to have a condition for something like this:
- if statement
- if...else statement
- if...elseif....else statement
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2014 11:20 AM
As suggested by Jim you can use the switch statement.
Otherwise to make it more of geeky you can modify the condition scripts of if conditions.
1. Checkout any workflow
2. In any of the if activity, right click on activity and select add condition, you will see new form something like this.
Activity.result is the value you return from if condition or if script.
You can use script and return as many values as you want and create many flows as shown below.
Hope it Helps!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-22-2015 08:04 AM
Just ran across a lab that walks through doing exactly what I was needing to do.
Here's the link for anyone looking to accomplish this
Mini-Lab: Workflows - Playing With the If Activity
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2017 02:02 PM
What I've discovered about evaluating the activity.result value in the IF workflow activity, is that activity expects the value of activity.result to be only 'yes' or 'no' and nothing else. If you try to set activity.result to something other than 'yes', for example, 'contact_requested', the value of activity.result will be 'no'.
Which is odd because the Wiki uses the language "Possible result values are:" and then lists 'yes' and 'no', but the wording of "possible" implies that activity.result can be set to something other than 'yes' or 'no'.
To get around the activity.result limitation, you can script any other evaluation in the condition variables of the IF activity. The excellent mini-lab written by Steven Bell outlines this technique. The Conditions in his lab evaluate the value of workflow.scratchpad values and not the activity.result value.
Michael
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2017 04:20 AM
This method did not work for me, in condition it only accepts activity.results == 'yest' and activity.results == 'no'.
I am trying to add four conditions Windows, Linux, Other OS and Incorrect input. I have script written where I am returning value as return 'windows'/'linux'/etc.. but that does not work.
Any way to sort this issue?