`Workflow Run Script return/exit

dmfranko
Kilo Guru

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;

}

...

1 ACCEPTED SOLUTION

Kalaiarasan Pus
Giga Sage

var something = doSomething();


if(something)


{


var somethingElse = doSomethingElse();


if(somethingElse != -1){


  something else script


}


}




Return statement is not required and cannot be used either


View solution in original post

4 REPLIES 4

Uncle Rob
Kilo Patron

If there's only two endpoints, could you use the IF activity instead and output a yes / no?


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.


Kalaiarasan Pus
Giga Sage

var something = doSomething();


if(something)


{


var somethingElse = doSomethingElse();


if(somethingElse != -1){


  something else script


}


}




Return statement is not required and cannot be used either


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.