---
schema_version: "1"
id: 3d7be93ffdd8205c4963993e831e1d3d66ac18c784f8c2e122e6617c1a6f7d2e
title: Customize Omniscript Error Messages
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/xcloud/264-0-0/os_customize_omniscript_error_messages_10378.md
canonical_url: https://help.salesforce.com/s/articleView?id=xcloud.os_customize_omniscript_error_messages_10378.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 3b02eee267599594e7ead724ba5c5bbde49539bba27814e59536a32735ec632b
description: The error message handler enables you to replace default error messages from remote apex calls with more user-friendly error messages when errors occur in Omniscript. The Error Messages handler property is available in File elements, Image elements, all Action elements, and Setup.
products:
  - Omnistudio
release: "264"
---
# Customize Omniscript Error Messages

The error message handler enables you to replace default error messages from remote apex calls with more user-friendly error messages when errors occur in Omniscript. The Error Messages handler property is available in File elements, Image elements, all Action elements, and Setup.

![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

Error Messages set in the Setup properties apply to any matching error returned by an element, while Error Messages set in an Action’s properties only render for that Action.

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small ">
        <colgroup>
          <col>
          <col>
        </colgroup>
        <thead class="slds-text-title_caps ">
          <tr class="">
            <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d99575e44">
              <p style="margin-bottom:0;">Error Message Type</p>
            </th>
            <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d99575e50">
              <p style="margin-bottom:0;">Description</p>
            </th>
          </tr>
        </thead>
        <tbody>
          <tr class="">
            <td data-label="Error Message Type" class="slds-cell-wrap" style="vertical-align:top;" headers="d99575e44 ">
              <p style="margin-bottom:0;">
                <strong class="uicontrol">Default Error Message</strong>
              </p>
            </td>

            <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d99575e50 ">
              <p style="margin-bottom:0;">A default message that returns when no Custom Error Messages are matched or
                defined. </p>
            </td>

          </tr>
          <tr class="">
            <td data-label="Error Message Type" class="slds-cell-wrap" style="vertical-align:top;" headers="d99575e44 ">
              <p style="margin-bottom:0;">
                <strong class="uicontrol">Custom Error Messages</strong>
              </p>
            </td>

            <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d99575e50 ">
              <p>Messages that are returned based on the defined path and value. Custom Error
                Messages are configured using the following fields:</p>
              <ul>
                <li>
                  <p><strong class="uicontrol">Path</strong>: A merge field path that locates the
                    original default value inside an error object.</p>
                </li>

                <li>
                  <p><strong class="uicontrol">Value</strong>: The original error message, including
                    spaces, that will be replaced by the text defined in the Message
                    field. This value must match the original error exactly.</p>
                </li>

                <li>
                  <p><strong class="uicontrol">Message</strong>: The custom message that will replace
                    the error text defined in the Value field.</p>
                </li>

              </ul>
            </td>

          </tr>
        </tbody>
      </table>

## Set the Default Error Message on an Omniscript Element

Replace a Default Error Message with a user-friendly error message when a remote apex call error occurs in your Omniscript. A default message returns when no custom error messages are matched or defined. Update the default error messages for Image, Action, and File elements.

Before You Begin

Before configuring **Error Messages**, preview the errors to determine their format.

1. Open the **Error Messages** property in the element that renders the error.
2. In the **Default Error Message** field, enter your custom message.
3. Preview the error to ensure the message renders.

## Set a Custom Error Message That Returns as an Object

Set a Custom Error Message for an error that returns as an object. A Custom Error Message returns based on a defined path and value. Set custom error messages for File elements, Image elements, all Action elements, and Setup.

Before You Begin

Before configuring **Error Messages**, preview the errors to determine their format.

1. Run the Omniscript to encounter the error.
2. Determine the path to the error. For example, the path for errorCode in the following error `[{"errorCode":"NOT_FOUND","message":"The requested resource does not exist"}]` is **0** | **:** | **errorCode** .
3. Copy the error message text that follows the path. For example, the error message text for errorCode in the following error: `[{"errorCode":"NOT_FOUND","message":"The requested resource does not exist"}]` is **NOT\_FOUND** .
4. Open the **Error Messages** property in the **Action Element** that is rendering the error.
5. In the **Path** field, enter the path determined by Step 2.
6. In the **Value** field, paste the original error.
7. In the **Message** field, enter your custom message.
8. Test to ensure the message is being replaced.

## Set a Custom Error Message That Returns as a String

Set a Custom Error Message for an error that returns as a string. A Custom Error Message returns based on a defined path and value. Set custom error messages for File elements, Image elements, all Action elements, and Setup.

Before You Begin

Before configuring **Error Messages**, preview the errors to determine their format.

1. Run the Omniscript to encounter the error.
2. Copy the text following the colon after the word Error.
3. Open the **Error Messages** property in the Action Element that’s rendering the error.
4. In the **Path** field, enter the path to the original error using a merge field syntax.
    
    For example, to reference the error message in this JSON string:
    
    ```json
    {
       "errorMessage" : "An Error has occured in an apex class",
       "error" : "OK"
    }
    ```
    
    Enter errorMessage in the Path field.
    
    If the JSON string is more complex such as:
    
    ```json
    {
      "errors" : [ { "errorMessage" : "An error has occured. " }]
    }
    ```
    
    Enter errors|0:errorMessage in the Path field.
5. In the **Value** field, paste the original error.
6. In the **Message** field, enter your custom message.
7. Test to ensure the message is being replaced.

#### See Also

- [Access Omniscript Data JSON with Merge Fields](https://help.salesforce.com/s/articleView?id=xcloud.os_access_omniscript_data_json_with_merge_fields_22053.htm&release=264.0.0&type=5 "Enable Omniscript elements and element properties to access data JSON using merge fields. A merge field is a variable that references the value of a JSON node. For example, if a JSON node is \"FirstName\": \"John\", then the merge field %FirstName% returns John.")