Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've noticed in triggers it is not necessary to use CRUD calls as it is in apex classes. However if I am updating a field on a different object to the one the trigger is on, do I need to do it then?

Basically when a contract is activated, I need to mark an opportunity that is related to it (with a custom field) as closed won.

share|improve this question
up vote 1 down vote accepted

The only time that you don't need to call insert, update or upsert in a Trigger is then you are in a Before trigger and you are modifying the record that the Trigger is on, this is because the Trigger is running before the records are actually committed to the database, so after the trigger is run the objects will be committed by the platform. For all other scenarios you need to call insert, update or upsert

share|improve this answer

In a before trigger you can make changes to the records which have caused the trigger to fire, and you don't have to explicitly CRUD them.

If you update records on another object, or records on the same object but not in this trigger context then you need to be explicit with an update for this to work.

For example if you have a before update trigger on your contract object, and record A is updated, then you can make any changes you want to record A in the trigger without calling doing an explicit update. If you want to update other Contract records which aren't in the trigger or you want to update Opportunities then you do need to call database update.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.