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

Have you tried to put the logs and see what current.variables.location is returning?



Thanks,


Sunil Safare


Hi Chris,



Can you try with one if condition and check the behavior once.


if(current.variables.location.getDisplayValue() != 'Olofstrom')


do you want me to include the returns?


I tried the one If statement and it work the opposite way I wanted to but that's ok I can switch the tasks, how can I add multiple locations


actual individual If condition does not work