Pull results from a variable lookup select box?

SC10
Kilo Guru

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.

19 REPLIES 19

SC10
Kilo Guru

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);


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.


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.


These should show in the Script Log Statements.


I can't locate them in that log, how odd.