- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2015 11:47 AM
Hello,
I have a workflow run script which I'm trying to exit under certain conditions. I'm not clear on how I can do this. If I just use a return I receive an error. For example:
var something = doSomething();
if(!something){
//Don't go on
return;
}
// Continuing on
var somethingElse = doSomethingElse();
if(somethingElse == -1){
// Don't go on
return;
}
...
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2015 12:30 PM
var something = doSomething();
if(something)
{
var somethingElse = doSomethingElse();
if(somethingElse != -1){
something else script
}
}
Return statement is not required and cannot be used either
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2015 12:09 PM
If there's only two endpoints, could you use the IF activity instead and output a yes / no?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2015 12:21 PM
I started by returning a workflow.scratchpad.result and then using an if script, but I want to be able to control the flow from within the one script, but maybe that's not possible. If I try to do a "return 'no'" from the workflow script it throws an error as well.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2015 12:30 PM
var something = doSomething();
if(something)
{
var somethingElse = doSomethingElse();
if(somethingElse != -1){
something else script
}
}
Return statement is not required and cannot be used either
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2015 06:36 PM
Thanks, I knew a return statement wasn't required, but I wasn't sure if it could be used. I did take a similar approach that you described.