Pull results from a variable lookup select box?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-06-2013 04:31 PM
I have a variable, called Variable1 that is a lookup select box, pulling from a table. The table contains entries with values of A, B, and C.
In my workflow, I have an If statement returning a Yes or No. I would like the If statement to result in Yes, if the client script's select box variable selects "A" or "B" as it's value. If "C" is chosen, it would result in a No.
I tried using the following script for the If in the workflow, but am getting GetDisplayValue not defined as an error:
answer = isSmart();
function isSmart(){
var check= getDisplayValue(Variable1);
if(check == "A" || "B"){
return 'yes';
}else{
return 'no';
}
}
Any help is greatly appreciated.
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-09-2013 12:07 PM
Ran another test, chose the "iPhone 5S" option this time around, and again it resulted in a No instead of a Yes. No faults.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-09-2013 12:38 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-09-2013 12:47 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-09-2013 01:13 PM
Did you remove the .getDisplayValue() from your WF? What are your logs showing?
Feel free to contact me directly via my email and we can look together in your instance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-09-2013 01:18 PM
The following is set up and working on DEMO007:
https://demo007.service-now.com/com.glideapp.servicecatalog_cat_item_view.do?sysparm_id=039c516237b1300054b6a3549dbe5dfc&sysparm_preview=true&sysparm_stack=no
answer = isSmart();
function isSmart(){
gs.log('Variable - '+current.variables.item);
var check = current.variables.item;
gs.log('Smart Phone - '+check);
if (check == 'iPhone 5S' || check == 'Apple iPhone 5C (Recommended Selection)') {
return 'yes';
}else{
return 'no';
}
}