Task - Stop

Declaration

<AMTASK ACTIVITY="stop" STATUSTYPE="text (options)" ERRORNUMBER="number" ERRORTEXT="text" />

Related Topics   

Description

Stops execution of the current task. Supports status code output, including Success, Stop, or Error. If the status code is set to Error, this activity supports output of a custom error number and/or text to the Automate Event Log.

Practical Usage

Commonly used inside an If activity to immediately stop execution of the current task if a certain condition is met. Conveniently returns a status or error number/text to output to other applications.

Parameters

General

Property Type Required Default Markup Description
Status type (unlabeled) Text (options) Yes Aborted
  • STATUSTYPE="SUCCESS"
  • STATUSTYPE="ERROR"
The type of status to return when the task stops. The selected status will appear in the Automate Event Log. The available options are:
  • Aborted (default) - The task will return an aborted status.
  • Success - The task will return a success status.
  • Error - The task will return an error status and user-defined error number and/or text.
Custom error number Number Yes (Empty) ERRORNUMBER="123" The user-defined error number to return when the task stops. This parameter becomes available and is required if the Status type parameter is set to Error.
NOTE: 0 is a reserved system error number and is not available for use.
Custom error text Text No (Empty) ERRORTEXT="ErrorBad" The user-defined error text to return when the task stops. This parameter becomes available if the Status type parameter is set to Error.

Description

Error Causes

On Error

Examples

NOTE:
  • The sample AML code below can be copied and pasted directly into the Steps Panel of the Task Builder.
  • Parameters containing user credentials, files, file paths, and/or other information specific to the task must be customized before the sample code can run successfully.

Example 1

This sample task stops a task and throws error number 8080 and error text ErrorBad.

Copy
<AMTASK ACTIVITY="stop" STATUSTYPE="ERROR" ERRORNUMBER="8080" ERRORTEXT="ErrorBad" />

Example 2

This sample task stop a task if the condition in step 1 returns FALSE.

Copy
<AMIF EXPRESSION="1 = 2" USECOMPLEXUI="YES" />
<AMSHOWDIALOG MESSAGE="If the previous step returns TRUE, this message box will be displayed" />
<AMELSE />
<AMSHOWDIALOG MESSAGE="If the previous step returns FALSE, this message box will be displayed and the following step will stop this task" />
<AMTASK ACTIVITY="stop" />
<AMIF ACTIVITY="end" />