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 10:39 AM
Ah eagle eyes you have there!
Made the fix, but now it's faulting with "Fault description: "Check" is not defined."
My code is as follows:
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';
}
}
gs.log('Smart Phone - '+check);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-09-2013 10:48 AM
Add the log within your function, I also added a log for your variable values:
function isSmart(){
gs.log('Variable - '+current.variables.smart_phone+' DISPLAY: '+current.variables.smart_phone.getDisplayValue());
var check = current.variables.smart_phone.getDisplayValue();
gs.log('Smart Phone - '+check);
if (check == 'Apple iPhone 5S' || check == 'Apple iPhone 5C (Recommended Selection)') {
return 'yes';
}else{
return 'no';
}
}
Let me know what these logs show if doesn't work. If it does work you can remove your logs.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-09-2013 11:00 AM
That looks to have worked. However it is resulting in a "No" result, even though I did select "Apple iPhone 5C (Recommended Selection)"
Which log would capture this data? I've looked through All logs area and can't pinpoint the logging.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-09-2013 11:30 AM
These should show in the Script Log Statements.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-09-2013 11:58 AM
I can't locate them in that log, how odd.