1

I have a simple question: in a before update/insert trigger, do I manually have to call update on a field that I want to change values in or, since that object is going to be inserted/updated after this trigger fires, will that value be taken into account when the insert takes place?

2

No. if a trigger fires on a record (or more) and you update its fields in the trigger logic, those changes are taken into account in the resulting database manipulation, so you don't have to do an insert/update in the trigger logic (unless you want to insert/update stuff on other records than the trigger records of course).

Edit: In fact, I think that if you try to update a record that triggered a before insert, then you get a DML error because you can't update a record that hasn't been inserted yet. See: http://www.salesforce.com/us/developer/docs/apexcode/index_Left.htm#CSHID=apex_triggers.htm|StartTopic=Content%2Fapex_triggers.htm|SkinName=webhelp

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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