exam questions

Exam Certified Platform Developer II All Questions

View all questions & answers for the Certified Platform Developer II exam

Exam Certified Platform Developer II topic 1 question 45 discussion

Actual exam question from Salesforce's Certified Platform Developer II
Question #: 45
Topic #: 1
[All Certified Platform Developer II Questions]

An Apex Trigger creates a Contract record every time an Opportunity record is marked as Closed and Won. This trigger is working great, except (due to a recent acquisition) historical Opportunity records need to be loaded into the Salesforce instance.
When a test batch of records is loaded, the Apex Trigger creates Contract records. A developer is tasked with preventing Contract records from being created when mass loading the Opportunities, but the daily users still need to have the Contract records created.
What is the most extendable way to update the Apex Trigger to accomplish this?

  • A. Use a Hierarchy Custom Setting to disable the Trigger for the user who does the data loading.
  • B. Use a List Custom Setting to disable the Trigger for the user who does the data loading.
  • C. Add the Profile Id of the user who does the data loading to the Trigger so the Trigger won't fire for this user.
  • D. Add a Validation Rule to the Contract to prevent Contract creation by the user who does the data loading.
Show Suggested Answer Hide Answer
Suggested Answer: A 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
costansin
Highly Voted 7 months, 4 weeks ago
B: we dont need list C: Don't hardcode ids into code D: Might ruin related functionality Gotta be A
upvoted 5 times
...
BrainMelt12
Most Recent 1 month, 1 week ago
Selected Answer: A
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_customsettings.htm A is correct because it's configurable, doesn’t require code changes, and allows different users to have different behaviors dynamically. B: Less flexible than a Hierarchy Custom Setting because it doesn't allow per-user or per-profile configurations. Requires explicit reference in Apex, making it less extendable. C: Hard coding Ids is bad practice and requires modifying the trigger every time a new data loader user is introduced. D: Doesn't prevent the trigger from firing, only stops Contract creation after the trigger executes.
upvoted 1 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago