You are here:
Handle Errors by Using a Try-Catch Block
Handle errors in Integration Procedures by using Try-Catch Blocks. A Try-Catch Block lets you "try" running the steps inside it and then "catch" the error if a step fails.
To set up a Try-Catch Block:
- Drag a Try-Catch Block into the Structure panel and make sure its Fail on Block Error checkbox is checked.
-
Configure the "catch" behavior — what the Try-Catch Block will do if a failure occurs. You can choose one or both of these options:
-
Under Failure Response, specify a key-value pair to return as the response. The value can be a formula. In Spring '20 and later releases, the value can include merge fields.
-
Under Custom Failure Response, specify a Remote Class and a Remote Method to execute an Apex class. The Apex class must implement Callable.
-
-
Drag substeps into the Try-Catch Block, and make sure the Fail on Step Error checkbox is checked for each step that must trigger the "catch" behavior if it fails.
You can optionally specify a Failure Condition Formula, which evaluates to TRUE if a specific step has failed to execute successfully.
- Create a Try-Catch Block Example
An Integration Procedure creates and deletes a Contact with the specified LastName and returns an error message if the LastName is blank. - Create a Try-Catch Block Example with a Formula
An Integration Procedure finds Contacts with the specified Name and returns an error message if none are found. Because returning no records normally isn't considered a failure, the Omnistudio Data Mapper Extract Action within the Try-Catch Block includes a Failure Condition Formula.

