---
schema_version: "1"
id: c450722ddb456d5d8165194cde35a9f6b5b1654eef940f7344dd567ea173be23
title: Set Errors in an Omniscript
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/xcloud/264-0-0/os_set_errors_in_an_omniscript_19684.md
canonical_url: https://help.salesforce.com/s/articleView?id=xcloud.os_set_errors_in_an_omniscript_19684.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: fb3d01af095fca8c309fcef908bbc49588a76a011b10b83df64fce47c6374e5a
description: To handle potential end-user errors, add an error or validation message on one or more elements in a previous step based on conditions from future steps with the Set Errors element. For example, an email address isn't required during the initial step, but in a future step, the user states that they wish to be contacted by email. The Set Errors element runs after the step and returns the user to the initial step with custom error messages.
products:
  - Omnistudio
release: "264"
---
# Set Errors in an Omniscript

To handle potential end-user errors, add an error or validation message on one or more elements in a previous step based on conditions from future steps with the Set Errors element. For example, an email address isn't required during the initial step, but in a future step, the user states that they wish to be contacted by email. The Set Errors element runs after the step and returns the user to the initial step with custom error messages.

- The name of a Set Errors element must be unique within an Omniscript and all the reusable Omniscripts it uses.
- The Set Errors action element doesn’t support File, Image, Messaging, and Formula elements and doesn’t support custom labels.
- Use the Set Errors element if the validation depends on multiple steps in the Omniscript. If you want to use the required field or a formula or messaging element for validation, you can only set requirements and conditions on elements in the current step.
- Avoid using the Set Errors element for validations in a repeat block. In such cases, use a Messaging element. See [Display Messages in Omniscripts](https://help.salesforce.com/s/articleView?id=xcloud.os_display_messages_in_omniscripts_19551.htm&release=264.0.0&type=5 "Display comments, requirements, and success and warning messaging depending on whether the validate expression returns True or False. Configure the Messaging element after creating an element, such as a formula or aggregate, to display validation messages in the OmniScript. Merge fields are supported in messages.").

![Note](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_note.png)

Note When Set Errors is used, it results in two distinct behaviors. First, the error message on an input is transient, which means, it vanishes when the user clicks away from the field but reappears if they try to proceed by selecting Next, if not fixed. Second, if Set Errors is used on multiple inputs, the errors are shown sequentially rather than all at once. The subsequent set of errors will only be shown after the first set of triggered errors has been resolved.

1. From the elements panel, drag the **Set Errors** element to the canvas.
2. Add a conditional to control when the Set Errors message displays.
    
    Without a conditional the error persists in the Omniscript. See [Conditionally Display Omniscript Elements](https://help.salesforce.com/s/articleView?id=xcloud.os_conditionally_display_elements_using_the_conditional_view_property_19389.htm&release=264.0.0&type=5 "With the Conditional View property, you can hide an element or a group of elements in a block or step based on certain conditions. Every step, block, or element supports at least one conditional view. Elements contain up to three conditional view options depending on the type of element. For example, an action outside of a step doesn’t have a Read-Only option since the action isn’t visible.").
3. To set the validation for the Set Errors element:
    1. In the Element Error Map section, click **Add Element Value**.
    2. Select the name of the element for which you want to set up validation.
    3. In the **Value** field, enter the error message that displays to the user.
    4. If necessary, select an expression for the element value and enter the validation expression in the **Value** field.
        
        Expressions can include:
        
        - Merge fields from a previous step (%elementName%)
        - Literal value
        - Concatenated values
        - Results of formulas and functions
        - Expressions that combine the options, such as "Case Status: %caseStatus%"