Returns the numeric exit code of the result.
exitcode(result:result) -> number
The result of the step whose exit code you want to get.
The following job consists of two steps. The first step invokes a Windows command line command which attempts to create a directory called data in the current working directory (C:\FlowForce). The result of this step is declared as outcome. The second step gets the outcome and returns the numeric exit code from it, with the help of the exitcode function. The numeric exit is then converted to a string, with the help of the string function. This conversion is required because the data type of the expression is string.
Importantly, the Abort on error option is not selected; otherwise, the execution would stop in case of error, and so there wouldn't be any exit code for the second step to process.
When the job runs for the first time, the data directory is supposedly created successfully, and the exit code would be 0. On subsequent runs, it cannot be created because it already exists, so the exit code would be 1.
See also Adding Error Handling to a Job.