How to check for a None value in a If condition in a workflow activity along with additional values
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2018 06:45 AM
Hello,
I am working on a workflow where i have an If condition that i need some help with.
The if condition needs to check for the values "A" , "B" & "None" (which is essentially a blank or null).
I have an if script below that checks for A & B but i am having issues with checking for None.
answer = ifScript();
function ifScript() {
var fldtype = workflow.scratchpad.return_result.attr_obj.ftype;
if (fldtype == 'A') {
workflow.info('Field Type = '+ fldtype);
return 'yes';
}
return 'no';
}
How do i also check for None in this script. Any input is appreciated.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2018 01:08 PM
Hi Roy,
Try the below code.
Please mark the below helpful/correct for others.
answer = ifScript();
function ifScript() {
var fldtype = workflow.scratchpad.return_result.attr_obj.ftype;
gs.log("Roy says fldtype is " + fldtype); //Check in script logs what is it set to
if (fldtype == 'A') {
workflow.info('Field Type = '+ fldtype);
return 'yes';
}
if (fldtype == ''){
//do what you need to
}
else{
return 'no';
}
}