script to return true or false within a condition in a workflow

patricklatella
Mega Sage

I'm looking to use a "Wait for condition" step in a workflow to check a field on a record and if that field has an entry to return "true" (and allow the workflow to continue) and if empty to return "false" and have the workflow wait until that field is entered.   To do this I've got the following script...it's the part in bold that I think is incorrect...any help would be great, thanks!

var ext = workflow.scratchpad.ext;

gs.info('ext is ' + ext);   //this part is working, I'm seeing the entry in the log

if (!ext,'');{ // trying to say here that if the field is not empty to return true

answer = true;

}

else {

return false; //then this part too seems to have issues with the "else" statement

}

5 REPLIES 5

victortrejo
Giga Expert

if(ext + "" != ""){


}


tee3
Giga Expert

answer = ifScript();



function ifScript() {


if (ext) {


return true;


}


return 'false';


}




Try this.


Shishir Srivast
Mega Sage

Can we try like



if (!ext)


answer=true;


else


answer=false;


patricklatella
Mega Sage

thanks guys for the input...I believe any one of these would work.



I'll mark "correct" when the button reappears, seems to be missing at the moment