Or condition in a basic Script

jobdexters
Kilo Contributor

Hi All,

I am not very good in scripting and I am tying to make an IF condition in a workflow.

Since the OOB function is not properly working, I created the the following:

answer = (current.variables.u_pds2_server_location.u_display_name=="LocationA,Location (B),Location (C)") ? "yes" : "no";

The Location (B) and Location (C) is just named like this because they have these names in the table.

What I try to do is that the script checks if either one of the 3 locations is in the field, with a yes or no output..

So if Location is LocationA or Location (B) or Location (C) then yes

If location is not LocationA or Location (B) or Location (C) then no

I guess I need another differentiation between then other then the comma I used

Anyone? Thanks!  

1 ACCEPTED SOLUTION

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi Job,



Try this one.


var loc = current.variables.u_pds2_server_location.u_display_name


answer   = (loc == 'LocationA' || loc == 'LocationB' || loc == 'Locationc')? 'yes':'no'


View solution in original post

5 REPLIES 5

Nice one Pradeep