Newer Version Available

This content describes an older version of this product. View Latest

Customize Error Messages

Improve agent efficiency by displaying custom error messages in the Omni-Channel utility whenever a telephony action fails. By default, generic labels are displayed.

Custom error messages can be displayed in response to failed telephony actions. For example, you can display a custom error message in response to a failed acceptCall action. Here’s an example of how the custom error message flow works when the acceptCall telephony action fails.

  1. The agent tries to accept the call.
  2. Salesforce passes this information to the Connector API (vendorConnector), which in turn passes the information to your telephony provider.
  3. The Connector API responds.
  4. If the error is of type CustomError, Salesforce displays a custom error message. Otherwise, the default error string for MESSAGE_TYPE.ACCEPT_CALL is displayed.

Here’s a sample, taken from the baseConnector.js file in GitHub.

1} catch (e) {
2  isSupervisorConnected = false;
3  if (e instanceof CustomError) {
4    dispatchCustomError(e, constants.MESSAGE_TYPE.ACCEPT_CALL);
5  } else {
6    dispatchInfo(constants.INFO_TYPE.CAN_NOT_ACCEPT_THE_CALL, {messagetype: constants.MESSAGE_TYPE.ACCEPT_CALL, additionalInfo: e});
7  }
8}

Custom error messages can also be displayed at any time based on the publishError event type (eventType). Here’s an example of how the custom error message flow works with publishError MUTE_TOGGLE event type.

  1. The agent mutes the call.
  2. Salesforce passes this information to the Connector API (vendorConnector), which in turn passes the information to your telephony provider.
  3. The Connector API responds.
  4. If the error is of type CustomError, Salesforce displays a custom error message. Otherwise, the default error string for ERROR_TYPE.CAN_NOT_MUTE_ALL is displayed.

Here’s a sample, taken from the baseConnector.js file in GitHub.

1} catch (e) {
2  if (e instanceof CustomError) {
3    dispatchCustomError(e, constants.MESSAGE_TYPE.MUTE);
4  } else {
5    dispatchError(constants.ERROR_TYPE.CAN_NOT_MUTE_CALL, e, constants.MESSAGE_TYPE.MUTE);
6  }
7}

After you create a custom error message, whenever you invoke an API, a promise object is returned. If the promise resolves to a failure, Salesforce looks for a CustomError object to the promise response. If a CustomError object exists in the response, Salesforce displays the custom error. Otherwise, the default error message is displayed.

If a CustomError object exists in the promise response but Salesforce can’t find the labelName, the following message appears, and Salesforce doesn’t fall back to the generic error message, “We couldn’t find [namespace.customErrorLabel].”

Note

Whenever you create a custom error message, perform a test to ensure the message appears when the appropriate telephony action or event fails. Perform the test through the Errors section of your Service Cloud Voice phone simulator. You can find out more about the Errors section in the remote.html file of the demo connector in GitHub:

1<div class="slds-checkbox">
2  <input type="checkbox" name="options" id="throwErrorCheckbox"></input>
3  <label class="slds-checkbox__label" for="throwErrorCheckbox">
4  <span class="slds-checkbox_faux"></span>
5  <span class="slds-form-element__label">Display an error</span>
6  </label>
7</div>

Create Custom Error Messages

There are two ways to create custom error messages:
  • Create the custom labels for the error messages through the UI by following the steps in the Custom Labels page.
  • Create the custom labels for the error messages yourself, distribute them in a managed package to AppExchange, and finally deploy the managed package in your org. See the CustomError Connector API object for more information.

After you create a custom error message, perform a test to ensure the message appears when the appropriate telephony action or event fails.

Test Custom Error Messages

You can only test one custom error message at a time. Repeat these steps for each custom error message you want to test.

To test the custom error messages you configured:

  1. In the Errors section of your Service Cloud Voice demo connector phone simulator, select Display on error to display the message during the simulation.
  2. In the text box, enter the custom label you want to test. The custom label must be in the format <namespace>.<labelName>, where namespace is the name of the Salesforce org’s namespace prefix, and labelName is the name of the custom label in your org. If you don’t have a namespace, set the value to c. For example, c.cannotMuteLabel.
  3. Simulate the telephony action or event in the Omni-Channel utility and view the error message to make sure the customized version appears.
  4. Deselect Display or error after you're done testing your custom error messages.