IF Condition in workflow always returns yes

Christopher Dan
Kilo Contributor

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';

17 REPLIES 17

Chris,



I think below code works for you


  1. function ifScript() {  
  2.   if (current.variables.location.getDisplayValue() != 'Olofstrom' && current.variables.location.getDisplayValue() != 'Bielsko-Biala' && current.variables.location.getDisplayValue() != 'Gothenburg' && current.variables.location.getDisplayValue() != 'Forsheda')  

                                                                        return 'no';  


  1.   else  

                                                                        return 'yes';



Thanks,


Sunil Safare


Susan Britt
Mega Sage
Mega Sage

Chris,



Are you on Fuji?   I'm having the same issue on the latest patch of Fuji, but I was able to successfully create the scripts in Eureka without issue.


Susan,


I put the script into the task creation and it worked for me in Fuji.