Stop Task

 

Declaration

<AMSTOPTASK STATUSTYPE="text (options)" ERRORNUMBER="number" ERRORTEXT="test" />

See Also

Call Function | Stop Task | Write to Log | Enable/Disable Task | Shut Down AutoMate | Start Task | Trigger Task | Backup AutoMate

Description

Stops execution of the current task. Supports status code output, including success, aborted or error. If the status code is set to Error, this action supports output of a custom error number and/or text.

Practical Usage

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

Parameters

General Properties

Property

Type

Required

Default

Markup

Description

Returned status code

Text (options)

No

Success

STATUSTYPE="SUCCESS"

The type of status code to return when the task stops. The selected status will appear in the AutoMate Event Log. The available options are:

  • Success - The task will return a success status.

  • Aborted - The task will return an aborted status.

  • Error - The task will return a user defined error number and/or text.

Error Number

Number

No

(Empty)

ERRORNUMBER="123"

The custom error number that should be returned when the task stops. This parameter is available only if the Returned status code parameter is set to Error.

Error Text

Text

No

(Empty)

ERRORTEXT="ErrorBad"

The custom error text that should be returned when the task stops. This parameter is available only if the Returned status code parameter is set to Error.

Description Properties

The Description tab allows you to customize the text description of any step when it appears in the Steps Pane.

More on setting custom step description

Error Causes Properties

The Error Causes tab is part of AutoMate's Error Handling functionality which allows you to select / omit specific errors that will cause a particular step to fail.

More about error causes properties

On Error Properties

The On Error tab is part of AutoMate's Error Handling functionality which allows you to determine what the task should do if a particular step encounters an error.

More about on error properties

Additional Notes

Variables and Expressions

All text fields allow the use of expressions, which can be entered by surrounding the expression in percentage signs (example: %MYVARIABLE%, %Left('Text',2)%). To help construct these expressions, you can open Expression Builder from these fields by pressing F2.

More on variables
More on expressions

More on the expression builder

Example

NOTE: The code below can be copied and pasted directly into the Steps pane of the Task Builder.

 

Description: Stop this task and throw an error using custom error text "ErrorBad" and custom error code 8080.  

<AMSTOPTASK STATUSTYPE="ERROR" ERRORNUMBER="8080" ERRORTEXT="ErrorBad" />

↑ Top of Page