Valid PDI Dumps shared by ExamDiscuss.com for Helping Passing PDI Exam! ExamDiscuss.com now offer the newest PDI exam dumps, the ExamDiscuss.com PDI exam questions have been updated and answers have been corrected get the newest ExamDiscuss.com PDI dumps with Test Engine here:
Universal Containers wants Opportunities to no longer be editable when it reaches the Closed/Won stage. Which two strategies can a developer use to accomplish this?
Correct Answer: A,B
Universal Containers wants to prevent Opportunities from being edited once they reach the Closed/Won stage. To achieve this, the developer can use the following strategies: Option A: Use a validation rule. Correct Approach. A validation rule can be created on the Opportunity object to prevent users from editing records when the Stage is Closed/Won. The validation rule would evaluate whether the record's StageName is 'Closed Won' and, if so, display an error message when a user attempts to edit and save the record. Example Validation Rule: AND( ISPICKVAL(StageName, 'Closed Won'), ISCHANGED(ANYFIELD) // Replace ANYFIELD with specific fields if needed ) Benefits: Declarative Solution: No code required. Consistent Enforcement: Applies across all user interfaces and API. An Apex trigger can be written to check if an Opportunity record being modified has a StageName of 'Closed Won'. In a before update trigger, the trigger can prevent the save operation by adding an error to the record. Sample Apex Trigger: trigger PreventOpportunityEdit on Opportunity (before update) { for (Opportunity opp : Trigger.new) { Opportunity oldOpp = Trigger.oldMap.get(opp.Id); if (oldOpp.StageName == 'Closed Won' && opp != oldOpp) { opp.addError('Closed Won Opportunities cannot be edited.'); } } } Benefits: Programmatic Control: Allows for complex logic. Granular Enforcement: Can specify exact conditions under which edits are prevented. Approval Processes are designed for record approval workflows. They do not inherently prevent edits based on a field value like StageName. Option D: Use an auto-response rule. Incorrect. Auto-response rules are used to send automated email responses to Leads or Cases. They do not control record editability. Conclusion: The most appropriate strategies are A (Validation Rule) and B (Before-save Apex Trigger). Both methods effectively prevent users from editing Opportunities in the Closed/Won stage. Reference: Validation Rules Validation Rule Examples Option B: Use a before-save Apex trigger. Correct Approach. Apex Triggers Trigger Context Variables Options Not Suitable: Option C: Use an automatically launched Approval Process. Incorrect.