DEX-403 practice question 7 of 35

The sales Operations team at AWS Computing deletes accounts for a variety of a reasons. The sales ops director is worried that the Sales team may delete accounts that sales reps are actively selling into. Now should the app builder keep accounts with open opportunities from being deleted?

Full set: 291 questions
Answer options
A: Create an Apex Trigger on the Account object Correct answer
B: Create a validation rule on the Account object.
C: Remove the delete button on the account layout
D: Remove the Delete permission from the Sales Rep profile.
Correct Answer:
A. Create an Apex Trigger on the Account object
Explanation

An Apex before delete trigger is the correct and most robust solution among the choices provided. This trigger executes before a record is deleted from the database. A developer can write logic within this trigger to query for any related Opportunity records where the IsClosed field is false. If the query returns one or more records, the trigger can use the .addError() method on the Account record being deleted. This action cancels the deletion operation and displays a custom error message to the user, effectively enforcing the business rule regardless of whether the deletion was initiated from the UI, a list view, or an API call.

Why Incorrect

B. Create a validation rule on the Account object. Validation rules are designed to enforce data integrity during record creation and updates (save operations). They do not execute when a record is deleted.
C. Remove the delete button on the account layout. This is a superficial UI change. It does not prevent users from deleting records through other means, such as from list views, reports, or via API tools.
D. Remove the Delete permission from the Sales Rep profile. This is an incorrect solution because the scenario states the Sales Operations team deletes accounts. Furthermore, it is not conditional; it would prevent deletion of all accounts, not just those with open opportunities.
References:
1. Apex Developer Guide - Triggers: The official guide explicitly describes the use case for before delete triggers. It states, "You can use triggers to perform tasks that can’t be done by using the point-and-click tools in the Salesforce user interface... For example... preventing the deletion of a record if it’s in a certain state." The .addError() method is the standard mechanism to prevent a DML operation within a trigger.
Reference: Salesforce Apex Developer Guide, "Trigger Syntax" and "Trigger Context Variables" sections.
2. Salesforce Help - Triggers and Order of Execution: The official documentation on the order of execution for DML operations clearly shows that validation rules are part of the "save" procedure but are NOT part of the "delete" procedure. The delete procedure involves before delete and after delete triggers, but no validation rules.
Reference: Salesforce Help, Article ID 000323235, "Triggers and Order of Execution".
3. Salesforce Help - Validation Rules: This documentation defines the purpose of validation rules. It states, "Validation rules verify that the data a user enters in a record meets the standards you specify before the user can save the record." This confirms their scope is limited to insert and update operations.
Reference: Salesforce Help, Article ID 000328373, "Validation Rules".
4. Salesforce Security Guide - Object Permissions: This guide details how object-level permissions work. The "Delete" permission is a blanket control for an object and does not allow for the record-level conditional logic required by the scenario.
Reference: Salesforce Security Guide, "Object Permissions" section.

Scroll to Top