Exit codes of actions

(imported comment written by MattPeterson)

We use exit code conditions quite a bit. I had issues with relevance substitutions well. This is what I do to get passed them (If you want to retrieve the exit code multiple times in a fixlet you will need a different parameter name each time). Creating parameters also lets you exit your action with that exit code.

//Run a command

wait run.cmd

//Set a parameter for the exit code

parameter “ExitCode” = "{if exist exit code of action then exit code of action as string else “52311”}

//If Exit code was not 0 then run another script

if {parameter “ExitCode” != “0”}

wait anotherscript.cmd

//Else continue

else

wait run2.cmd

//Now exit the script using the exit code from run.cmd

endif

exit {parameter “ExitCode”}

The problem I had was using exit code of action along with an if else statement. It worked fine as long as I didn’t have any prefetch commands in my aciton. If you are doing any downloads then the client will need to run all the if statements prior to starting the action. Since the commands haven’t run yet there is no exit code, so the client errors.

1 Like