Study for the Salesforce Platform Developer Exam. Study with flashcards and multiple choice questions, each question has hints and explanations. Get ready for your exam!

Practice this question and more.


What would be an effective method to update the value of a custom field in related opportunities when an Account record is updated?

  1. An Apex trigger on the Account object.

  2. A Process Builder on the Account object.

  3. A cross-object formula field on the Account object.

  4. A Workflow Rule on the Account object.

The correct answer is: An Apex trigger on the Account object.

Using an Apex trigger on the Account object to update a value in related opportunities when an Account record is updated is an effective approach for several reasons. Apex triggers allow for fine-grained control over the logic that executes in response to changes in Salesforce records. In this case, when an Account record is updated, the trigger can be written to specifically identify related Opportunities and modify the custom field accordingly. Triggers are particularly useful when complex logic is required that cannot be easily managed through declarative tools. They can handle bulk records efficiently, ensuring that if multiple Account records are updated at once, all related Opportunity records are updated in a single transaction. This capability is particularly important in a large organization where bulk updates might be common due to data migrations, batch processes, or mass editing by users. In contrast, while Process Builder could also achieve this outcome, it can become less efficient when dealing with larger volumes of data or more complex scenarios that involve multiple related objects. Cross-object formula fields only allow for display of values and do not permit updating records. Workflow Rules, while effective in certain situations, are less reliable for handling all use cases, especially as Salesforce has been moving towards Process Builder and ultimately Flow as its primary tools for automation. Thus