Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

How to check for a None value in a If condition in a workflow activity along with additional values

Roy
Kilo Contributor

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

1 REPLY 1

Pritha1
Mega Expert

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';
}
}