Action error evaluation
Summarize
Summary of Action error evaluation
Action error evaluation in ServiceNow enables you to catch step failures within actions and continue running the action while defining custom error handling behavior. This feature allows you to specify when an action returns an error state and customize the status codes and messages it produces. It is designed to improve error handling capabilities for flow designers, providing more detailed diagnostics and control over corrective actions.
Show less
Key Features
- Step failure handling: Allows steps to fail without stopping the entire action, supporting continued execution based on failure behavior settings.
- Custom error conditions: Create your own error conditions with specific labels, conditions, action states, status codes, and messages.
- Error evaluation logic: Evaluates error conditions sequentially from top to bottom and returns the first matching error state or the last step’s status if none match.
- Step Status data pills: Provide runtime details including an integer code (0 for success, 1 for error) and a system-generated error message for each step, which cannot be customized.
- Action Status data pills: Return runtime details of the overall action, including custom codes and messages defined by error conditions.
- Error condition configuration: Configure multiple error conditions as else-if logic blocks, each with a unique label and criteria, to identify and handle specific errors effectively.
Practical Configuration Components
- "If this step fails" option: Choose whether to continue running subsequent steps or go directly to error evaluation without affecting step status.
- Error Evaluation section: Defines the list of error conditions evaluated when the action runs.
- Add error condition option: Enables adding multiple error conditions to manage different failure scenarios.
General Guidelines
- Allow only independent steps to continue running when a failure occurs to prevent downstream errors.
- Limit error conditions to fewer than 10 to maintain optimal action performance.
- Use Step Status to identify failures in specific steps, especially when multiple similar steps exist, facilitating targeted error handling.
- Order error conditions from specific to general to ensure precise error matching and handling.
- Use descriptive labels for error conditions to quickly identify them without editing.
Benefits for ServiceNow Customers
By enabling action error evaluation, you gain robust control over how actions handle errors, improving flow reliability and diagnostics. You can continue processing when appropriate, customize error feedback for better troubleshooting, and tailor error handling to your unique business logic. This leads to more resilient automation workflows and clearer insights during error conditions.
Enable actions to catch step failures and continue running. Identify when specific error conditions occur and return your own action status code, status message, and error state.
Benefits
- Catch step failures and allow an action to continue running. Specify the failure behavior of each step you add to an action.
- Create your own error conditions. Specify when an action returns an error state as well as the status codes and messages they return.
- Provide more error handling information and options to flow designers. Use your own action status codes and messages to identify issues and provide details for corrective actions.
Action error evaluation step components
Each step offers these error evaluation components.
- 1. If this step fails option
- Option to continue running the next step or go to error evaluation. This option has no effect on the Step Status.
- 2. Step Status
- Object data pill containing runtime details about the step. Each step in an action returns a Step Status.
- 3. Step Status > Code
- Integer data pill indicating whether the step produced an error. A step returns a value of 1 when it produces an error for any reason. For example, a step can produce an error if it is missing mandatory input data or returns output in the wrong data type. A step returns a value of 0 when it runs successfully. You cannot customize these codes.
- 4. Step Status > Message
- String data pill containing the error message produced by the step or system operation. You cannot customize the step status message.
Action error evaluation configuration components
Action error evaluation consists of these configuration components.
- 5. Error Evaluation section
- Section containing possible error conditions. When an action runs, it evaluates the
available error conditions from top to bottom looking for a possible match. An
action returns the Action Status specified by the first matching error
condition. If there is no matching error condition, the Action status is set to
the Step Status of the last step run.
Note:Data stream actions have an error evaluation section for REST, SOAP, and JDBC steps. For more information see Data Stream actions and pagination.
- 6. Add error condition option
- Option to add an error condition. Each error condition is equivalent to an else if flow logic block. Only one error condition can be true at a time.
- 7. Error condition configuration
- Options available to configure an error condition.
- Label you want to use to identify this error condition
- Conditions that must be met to match this error condition
- Error state you want the action to return to flow
- Action Status Code you want the action to return to flow
- Action Status Message you want the action to return to flow
- 8. Action Status
- Object data pill containing runtime details about the action. An action always returns an Action Status.
- 9. Action Status > Code
- Integer data pill containing the code returned by the first matching error condition or the last step run. You can return your own code when you create a custom error condition.
- 10. Action Status > Message
- String data pill containing the message produced by a matching error condition or the last step run. You can return your own message when you create a custom error condition.
Flow and action error handling resources
- Flow and Action Error Handling Level 1: Retry and Action Error Evaluation - Workflow Automation CoE
- Flow and Action Error Handling Level 2: Flow Logic - Workflow Automation CoE
- Flow and Action Error Handling Level 3: Flow Error Handling - Workflow Automation CoE
- Flow and Action Error Handling Level 4: Good Practices and Summary - Workflow Automation CoE
General guidelines
Follow these general guidelines to achieve the benefits offered by action error evaluation.
- Allow only independent steps to continue running
- Allow a step to continue running if it does not return data required by a later step. If a step provides data necessary for later steps, then you know that the later steps cannot run successfully.
- Avoid more than 10 error conditions
- While there is no limit to the number of error conditions you can create, each error condition requires evaluation. The more error conditions your action has to evaluate, the potentially slower your action can run.
- Identify specific step failures
- You can use the Step Status to identify when a specific step fails. Identifying a specific step can be useful when your action contains multiple instances of the same type of step. You may also want to identify a specific step so that a flow error handler can take specific corrective actions for the failure.
- Put specific error conditions before general error conditions
- Error evaluation stops when the action finds a matching error condition. Putting general error conditions first may prevent the action from ever matching specific error conditions.
- Use descriptive error condition labels
- Identify an error condition without having to edit it. By default, you can only see error conditions when you edit them.