CRT-450 practice question 24 of 30

A developer is asked to prevent anyone other than a user with Sales Manager profile from changing the Opportunity Status to Closed Lost if the lost reason is blank. Which automation allows the developer to satisfy this requirement in the most efficient manner?

Full set: 201 questions
Answer options
A: An Apex trigger on the Opportunity object
B: An error condition formula on a validation rule on Opportunity Correct answer
C: A record trigger flow on the Opportunity object
D: An approval process on the Opportunity object
Correct Answer:
B. An error condition formula on a validation rule on Opportunity
Explanation

A validation rule is the most efficient tool for this requirement. It is a declarative feature designed specifically to prevent a record from being saved if it does not meet defined criteria. The rule's error condition formula can concisely check multiple conditions simultaneously: the Opportunity Status being changed to "Closed Lost," the lost reason field being blank, and the current user's profile not being "Sales Manager." This approach is more efficient in terms of both system performance and development/maintenance effort compared to programmatic or more complex automation tools.

References

1. Salesforce Help

Validation Rules: "Validation rules verify that the data a user enters in a record meets the standards you specify before the user can save the record... For example

you can ensure that all account numbers are 9 digits long or that discounts over 40% require a manager's approval." This aligns directly with the question's requirement to verify data based on conditions before saving.

2. Salesforce Architects

Record-Triggered Automation Decision Guide: This guide provides a clear hierarchy for choosing automation tools. For scenarios that "prevent the user from saving the record if a field value is invalid

" the guide explicitly recommends using a Validation Rule. It positions validation rules as the primary tool for this function

before considering more complex tools like flows or Apex.

3. Salesforce Developer Documentation

Triggers and Order of Execution: The documentation on the order of execution shows that system validation rules are executed before Apex before triggers and before-save record-triggered flows. This makes them the first and most efficient gate for enforcing data integrity. (Step 4: Runs system validation rules. Step 5: Executes before-save record-triggered flows. Step 7: Executes before triggers).

Scroll to Top