IF Condition in workflow always returns yes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-21-2015 04:21 AM
I am try to write a IF condition advanced script that will be yes if some locations but no if it is the rest. This will allow me to assign it to the correct assignment group in the workflow. The location variable is a reference field so im not sure if that my issue or not. Please tell me why my script keeps returning yes every time. See script below.
function ifScript() {
if (current.variables.cmn_location != 'Olofstrom' || current.variables.cmn_location != 'Bielsko-Biala' || current.variables.cmn_location != 'Gothenburg' || current.variables.cmn_location != 'Forsheda')
return 'yes';
else
return 'no';
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-21-2015 04:55 AM
Victor,
That was not working properly, so I figured a script would be better.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-21-2015 05:03 AM
As Pradeep suggested pasting your code or condition builder examples would help.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-21-2015 05:39 AM
Hi Chris,
I feel that above script always return Yes. Suppose if location is 'Olofstrom' then it looks for other condition(like location is not equal to 'Bielsko-Biala') and returns yes because of OR condition and if your location is something else then also it returns Yes. So above condition returns Yes everytime. I would like to know your requirement, may be you are missing to put AND conition instead of OR like
current.variables.cmn_location.getDisplayValue() != 'Olofstrom' && current.variables.cmn_location.getDisplayValue() != 'Bielsko-Biala' && current.variables.cmn_location.getDisplayValue() != 'Gothenburg' && current.variables.cmn_location != 'Forsheda'
Thanks,
Sunil Safare
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-21-2015 05:54 AM
Sunil,
I am trying to accomplish separating the requests to two different tasks based on their location.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-21-2015 05:52 AM