Salesforce, Python, SQL, & other ways to put your data where you need it

Need event music? 🎸

Live and recorded jazz, pop, and meditative music for your virtual conference / Zoom wedding / yoga class / private party with quality sound and a smooth technical experience

Salesforce Pluralsight notes

05 Mar 2022 🔖 salesforce
💬 EN

Table of Contents

I need to get rid of some paper at my desk.

I think my notes must be from Play by Play: Adopting Trigger Design Patterns in Existing Salesforce Orgs by Don Robins and Dan Appleman during a free weekend. I know for sure it’s a Dan-on-Pluralsight thing somehow.

Coordinating DML

Dan builds out an Apex class called SimpleLeadUpdater, and two of its methods are .getLead() and getLead(Id theId).

Principles:

  • Never let a trigger handler instantiate (directly or through SOQL) its own SObjects that will eventually be subjected to DML.
  • Always access such an SObject’s current state through .getLeadId(Id).
  • This is something to take care of in your codebase even before you worry about reentrancy control or dependency injection.

Cooperating with declarative

Use custom checkbox fields – or DateTime & “which job’s DateTime is it?” text fields – on objects to let triggers & declarative automations inter-communicate. Bypass_Declarative, CreatedByDeclarative, etc.

You might already be familiar with the idea of passing information to automation through custom field values if you have some custom fields that ETL jobs write to, and that automations factor into their decisions.

--- ---