PDI · Question #29
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…
The correct answer is D. An error condition formula on a validation rule on Opportunity. A validation rule with an error condition formula is the most efficient declarative solution to prevent record saves based on field values and user profiles.
Question
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?
Options
- AA record trigger flow on the Opportunity object
- BAn Apex trigger on the Opportunity object
- Capproval process on the Opportunity object
- DAn error condition formula on a validation rule on Opportunity
How the community answered
(25 responses)- A24% (6)
- B12% (3)
- C4% (1)
- D60% (15)
Why each option
A validation rule with an error condition formula is the most efficient declarative solution to prevent record saves based on field values and user profiles.
A record trigger flow could achieve this by raising a custom error, but a validation rule is purpose-built for preventing invalid record saves and is generally more efficient for such direct validation requirements.
An Apex trigger could implement this logic programmatically, but it requires coding and maintenance, making it less efficient than a declarative validation rule for this straightforward requirement.
An approval process is designed for multi-step approval workflows and is not an efficient mechanism to simply prevent a record save based on immediate field conditions and user profiles.
An error condition formula on a validation rule on the Opportunity object is the most efficient declarative automation, as it can directly evaluate the Opportunity Status, check for a blank Lost Reason, and verify the user's profile to prevent the record from being saved if the conditions are met.
Concept tested: Validation Rules for Data Integrity
Source: https://help.salesforce.com/s/articleView?id=sf.fields_defining_validation_rules.htm&type=5
Topics
Community Discussion
No community discussion yet for this question.