Apex Trigger Sample: Using a List – Salesforce Developer Curriculum Week 4

This homework asks you to create a trigger that creates 2 identical Contacts after an Account is created.

Considerations:

  • If I need to create 2 Contacts that are children of a newly-created Account, what DML statement is needed, and when is it needed? (Hint: before or after insert?)
  • Bulkifying code, a very Salesforce-y thing. In your trigger, where do you want your DML statement to occur? Why?
  • I initially just assigned the firstContact to the secondContact. That surfaced an error. Why?

 

This entry was posted in Salesforce.com - General, Tips. Bookmark the permalink.