- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-14-2015 02:47 AM
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!
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-14-2015 03:02 AM
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'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-14-2015 02:54 AM
Hello Job,
What about something like:
switch(current.variables.u_pds2_server_location.u_display_name)
{
case 'Location A':
answer = yes;
break;
case 'Location B':
answer = yes;
break;
case 'Location C':
answer = yes;
break;
default:
answer = no;
}
Regards,
Sergiu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-14-2015 03:11 AM
Thanks Sergiu, but it came back with a bunch of errors, which I will spare you

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-14-2015 03:02 AM
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'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-14-2015 03:12 AM
Thanks Pradeep, it did the trick!