If - Last Step
Declaration
<AMIF ACTIVITY="last_step" LASTSTEP="text (options)" RESULTCODE="number">
Description: Controls task flow depending on whether the last step was a success, general failure, or failed because of a specific error. If the result evaluates to TRUE, the task will execute the block of steps immediately following this step up until an End if step is encountered. If the result evaluates to FALSE, the block will be skipped and execution will proceed directly after the End if step (or if an Else step is encountered, the task will execute that block of steps instead, up until an End if step is encountered).
Practical Usage
Mainly used to provide custom error handling on steps that are set to continue on error. This activity executes conditional steps depending on the outcome of the previous step. It is commonly used to present a block of steps to be carried out if the previous step fails.
General Parameters
Property |
Type |
Required |
Default |
Markup |
Description |
---|---|---|---|---|---|
If the last step |
Text (Options) |
Yes |
Succeeded |
|
Specifies the condition to be met. The available options are:
|
Comma-delimited list of error codes |
Text |
Yes if last step failed with specific error |
(Empty) |
RESULTCODE="24007,30098" |
Specifies the error code(s) that the previous step generated upon failure. Multiple error codes can be entered by delimiting each with a comma (e.g., 24007, 30098, 20074). This parameter is available only if the If the last step parameter is set to Fails with specific error. |
Example
The sample AML code below can be copied and pasted directly into the Steps panel of the Task Builder.
Description: Determines if the last step returned one of these error codes: 20074, 20089. If so, a message box displays a message stating "Last step failed with one of the error codes specified." If not, a message box will display "Last step did not fail."
<AMIF LASTSTEP="failedwithcode" RESULTCODE="20074, 20089"> <AMSHOWDIALOG MESSAGE="Last step failed with one of the error codes specified." /> <AMELSE /> <AMSHOWDIALOG MESSAGE="Last step did not fail." /> </AMIF>