Play by Play is a series in which top technologists work through a problem in real time, unrehearsed and unscripted. In this course, Dan Appleman and Don Robins demonstrate updating data records and choosing design patterns in Apex. Learn how to Build out the test class with mock data, implement trigger based solutions, and discover a batch Apex scalable approach. By the end of this course, you'll be able manage, create, and update data based on the business processes in Apex on the Salesforce platform.
Don Robins is a well known Salesforce MVP, instructor, author, and speaker.
A custom business application developer for more decades than he cares to
admit, he focuses on Salesforce technical instruction and knowledge
Dan Appleman is a well known author, software developer, and speaker. Currently the CTO of Full Circle Insights, he is the author of numerous books, ebooks, and online courses on various topics (technology and other). His latest book is "Advanced Apex Programming" - advancedapex.com Personal Website http://danappleman.com.
Course Overview Welcome to this Salesforce Play by Play with Pluralsight. Salesforce Play by Play is an interactive series where we sit down with Salesforce experts such as MVPs, consultants, developers, and architects, to discuss common challenges faced every day by Salesforce customers. We'll be learning while discussing concepts and debating tradeoffs on various approaches to solving real-world problems. We learn by reviewing system configurations or writing code, and then exploring the benefits of any particular solution. In this course, we challenge Salesforce MVP and author Dan Appleman to show us how to write efficient, robust, and flexible Apex code to handle operations on a high volume of related Salesforce data. Dan walks us through a scenario where developers must work within platform limits in the context of Apex transactions when processing parent and child data. Along the way, we explore effective trigger and batch Apex design patterns that developers can use to build code resilient to declarative changes, such as with workflows and processes. They'll also show us how to factor into consideration various platform limits when choosing an approach for solving problems. And he'll walk us through some best practices in test-driven development while showing examples in debugging in the real world. Please join us for Managing Data in Salesforce using Apex. We hope you enjoy it.
Trigger solutions Okay, so now we need a class to do the work, so what are we doing, we need an account trigger, because we're looking for a change of the ownerId on the account. So let's go ahead and create a trigger, Apex Trigger, we'll call it ManagingDataAccountTrigger. And it's not an insert trigger, it's an update trigger. Right, it's before, and you could really sort of go either way on this one, we're not updating the account, so I see no reason not to do an after trigger. Yep. Because we're not actually going to update the account, so it doesn't really matter. And we're just going to call another function, so let's call it our ManagingApex1 class that we haven't created yet. We won't be able to save the trigger until we create it. That's right, so ManagingApex1. HandleAccountUpdate, and we're going to give it the trigger. new and trigger. oldMap parameters. Are we expecting we're going to be building more than one method on this class, or are you going to be building different classes for going forward, just curious. We call it handle update. Well, we're only going to have one trigger, right, that is sacred, you want to really minimize the number of triggers, you always want to put your functional code in Apex. So are we going to someday have more things than these kind of triggers, and if we're really going to be fancy, we would actually use a trigger framework. But we're not going there. We're not going there. They can read my book about that.