Safety in numbers

Now we have a basic trigger under our belt. Let's look at what might happen if we fire that trigger with one record. If this trigger fires with a single contact record, it will update every case related to that contact whenever the contact's phone number is changed. However, triggers rarely run with only one record, and because of this, our example trigger has a number of flaws. If the trigger executes with two records, this trigger will only modify those cases where the contact ID matches the first contact record. However, the Salesforce1 platform does not guarantee that our triggers will fire with a single record. In fact, with this platform, it is quite clear that triggers will execute with at least 1 but no more than 200 ...

Get Mastering Application Development with Force.com now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.