Newer Version Available
Customize Error Messages
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.
- The agent tries to accept the call.
- Salesforce passes this information to the Connector API (vendorConnector), which in turn passes the information to your telephony provider.
- The Connector API responds.
- 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.
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.
- The agent mutes the call.
- Salesforce passes this information to the Connector API (vendorConnector), which in turn passes the information to your telephony provider.
- The Connector API responds.
- 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.
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.
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:
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:
- In the Errors section of your Service Cloud Voice demo connector phone simulator, select Display on error to display the message during the simulation.
- 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.
- Simulate the telephony action or event in the Omni-Channel utility and view the error message to make sure the customized version appears.
- Deselect Display or error after you're done testing your custom error messages.