Book Image

Learning Apex Programming

5 (1)
Book Image

Learning Apex Programming

5 (1)

Overview of this book

Table of Contents (17 chapters)
Learning Apex Programming
Credits
Foreword
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

I fought the law and won


A few extra lines of code and we easily enabled our code to operate on twice as many records as allowed. If you look back at the limits in the previous chapter, you'll notice that we can query five times as many records as we can process with the DML statement. This means that twice as many records is not enough; we really need to be able to operate on five times as many. Over the years, many of the clients we work with came to us because their requirements well exceeded the Apex governor limits. You can always resort to using an external system and the Salesforce1 Platform's SOAP API, but we like to push Apex to the very edge, then cross our fingers and hit Enter! While it might be overkill, the following code block turns the dial up to 11 (literally) and allows us to blow our limits out of the water:

public static void updateContactPhones(
List<Account> priorAccounts, 
List<Account> updatedAccounts
){
  Set<Id> modifiedAccounts_Ids = new Set&lt...