script to return true or false within a condition in a workflow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2017 11:26 AM
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
}
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2017 11:38 AM
if(ext + "" != ""){
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2017 11:41 AM
answer = ifScript();
function ifScript() {
if (ext) {
return true;
}
return 'false';
}
Try this.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2017 11:49 AM
Can we try like
if (!ext)
answer=true;
else
answer=false;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2017 03:52 PM
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