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-06-2013 05:42 PM
It depends on what you have setup in your Select Box to be your 'value'.
You may be able to use: var check = current.variables.Variable1;
If your value is the sys_id of the Record then you will need to use:
var check = current.variables.Variable1.getDisplayValue();
If neither of these work, please include a screenshot of your Lookup Select Box variable.
Your If statement must also be separated like:
if (check == 'A' || check == 'B') {
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-06-2013 05:59 PM
Actually this should work no matter what your 'Lookup Value field' is set to:
var check = current.variables.Variable1.getDisplayValue();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-09-2013 10:08 AM
This is my code currently:
answer = isSmart();
function isSmart(){
var check = current.variables.smart_phone.getDisplayValue();
if (check == 'Apple iPhone 5S' || check == 'Apple iPhone 5C (Recommended Selection') {
return 'yes';
}else{
return 'no';
}
}
It is always resulting in the No.
What else could be causing this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-09-2013 10:18 AM
I believe you have a typo here:
if (check == 'Apple iPhone 5S' || check == 'Apple iPhone 5C (Recommended Selection)') {
I would also add a gs.log('Smart Phone - '+check); When the WF runs you can verify the value of 'check' in your logs.