Try-Catch Blocks, failure responses and rollback
How to set up a Try-Catch Block with Fail on Block Error and Fail On Step Error, return a Failure Response or run a Custom Failure Response class, define custom failures with a Failure Conditional Formula, read HTTP status codes, and keep a failed Data Mapper Load from saving partial records.
Implement robust exception handling using Try/Catch blocks to manage failures and ensure proper rollback.
~8 min read · 6 practice questions ·
What the exam expects
- Set up a Try-Catch Block so a failing step triggers its catch behavior: Fail on Block Error on the block, Fail On Step Error on each step that must trigger it.
- Configure the catch behavior with a Failure Response, a Custom Failure Response, or both.
- Define a custom failure with a Failure Conditional Formula, return only the failure data with Send Only Failure Response, and know the list-returning limitation.
- Find an HTTP Action's status code in the data JSON.
- Keep a failed Data Mapper Load from saving part of its records with Rollback On Error.
Key terms: Try-Catch Block (runs the steps inside it and catches the error if a step fails), Fail on Block Error (if the block fails, the whole procedure fails), Fail On Step Error (the procedure ends if this step fails; "Terminate when step fails" in the standard designer), Failure Response (key/value pairs returned on failure), Custom Failure Response (an Apex class and method run on failure), Failure Conditional Formula (a custom failure test that runs after the step).
Key facts
- Detail
- If the block fails, the entire procedure fails; setup says keep it checked
- Detail
- Fail on Step Error on each step that must trigger the catch
- Detail
- Terminate when step fails
- Detail
- Failure Response, Custom Failure Response, or both
- Detail
- A formula; merge fields from Spring '20
- Detail
- System.Callable on Standard Runtime
- Detail
- Runs after the step; can't use returned data from a list-returning action
- Detail
- Returns only the failure response when the action fails
- Detail
- In the ElementNameInfo node with headers and status
- Detail
- Load doesn't create or update sObjects if errors occur
Sources for this section (6)
- Try-Catch Blockhelp.salesforce.com (opens in a new tab)
- Try-Catch setuphelp.salesforce.com (opens in a new tab)
- IP Actionshelp.salesforce.com (opens in a new tab)
- Supported Featureshelp.salesforce.com (opens in a new tab)
- Error handlinghelp.salesforce.com (opens in a new tab)
- Data Mapper Loadhelp.salesforce.com (opens in a new tab)
- Why does a Failure Conditional Formula on a list-returning Extract never fire on a value in the list?
- When does a step inside a Try-Catch Block trigger the block's catch behavior?
- Why choose Rollback On Error over Ignore Errors for an order and its lines?
- Where do you read the status code of an HTTP Action named SendLabel?
The questions are free to read. Answers with their sources and self-grading are included with the pack.
Keep reading with the Omnistudio Developer pack
- Core concepts
- Exam traps
- Worked scenario
The pack includes:
- All 46 lessons of the Omnistudio Developer guide, with reading progress
- Interactive decision walks and step-by-step sequence steppers
- Inline practice questions and one-click topic practice (6 questions for this lesson)
- An official source cited for every claim
- An AI tutor that answers from the guide
- Unlimited timed practice exams