Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-16-2023 08:48 PM
I am using an IF activity in the workflow editor to check the variable's value if it is Yes or No. The script is returning No always. I have attached the script for reference.
answer = ifScript();
function ifScript() {
var getVariable = current.variables.contact_center_supervisor_access.getDisplayValue().toString();
gs.log("value is" + getVariable);
if (getVariable == "Yes")
{
gs.log("test");
return 'Yes';
}
else
return 'No';
}
The script is printing correct values in the logs, ie the value of the variable is correct and when the IF condition is evaluated to be true the control is entering the loop but the final answer returned is NO.
Thanks in advance.
The script is printing correct values in the logs, ie the value of the variable is correct and when the IF condition is evaluated to be true the control is entering the loop but the final answer returned is NO.
Thanks in advance.
Solved! Go to Solution.
Labels:
- Labels:
-
Workflow
1 ACCEPTED SOLUTION

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-16-2023 09:08 PM
Hi Savitha,
Try below
answer = ifScript();
function ifScript() {
var getVariable = current.variables.contact_center_supervisor_access.getDisplayValue().toString();
gs.log("value is" + getVariable);
if (getVariable == "Yes")
{
gs.log("test");
return 'yes';
}
else{
return 'no';
}
}
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-16-2023 10:50 PM
var getVariable = current.variables.contact_center_supervisor_access.getDisplayValue();//getDisplayValue method returns string value so no need to use toString() again
Also check getVariable is having start letter as capital or small and use it in your if else loop
Thanks,
Manjusha Bangale