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:23 AM
Hi Chris,
Small change. Replace current.variables.cmn_location with current.variables.cmn_location.getDisplayValue()
current.variables.cmn_location; //Will give the sys_id
current.variables.cmn_location.getDisplayValue(); //Will give the display value
Hence the final script will be
function ifScript() {
if (current.variables.cmn_location.getDisplayValue() != 'Olofstrom' || current.variables.cmn_location.getDisplayValue() != 'Bielsko-Biala' || current.variables.cmn_location.getDisplayValue() != '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:40 AM
Pradeep,
Thanks for the suggestion but it is still returning yes every time, is there something im missing?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-21-2015 04:44 AM
Can you paste the complete script here as is.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-21-2015 04:53 AM