DmlWork a.k.a. the UoW meets Triggers
Building a neat UoW wrapper for compounding service methods effectively and merging the Unit of Work approach with updating SObject instances in Triggers.
Everything to do with the Apex programming language and coding on the core platform. Expect hints towards clean code, enterprise patters, mocking and more.
Building a neat UoW wrapper for compounding service methods effectively and merging the Unit of Work approach with updating SObject instances in Triggers.
Peeping into the Unit of Work to help with Batch job chaining and having to really think about who extends who when mocking and testing.
Building a flexible SOQL query result cache usable with Enterprise Patterns’ Selectors.
TL; DR; Creating a Logger to measure Limit usage in Apex and building Dashboard to monitor improvements (or otherwise) over time. The Problem Reviewing the logs is not easy. Sometimes, it’s even impossible. There is a limit to how much can be stored and the rest gets omitted. And having… Read More »Trigger Performance – Monitoring
Analysing trigger performance issues in Salesforce triggers and preparing a strategy for effective improvements taking complexity and risk into consideration
TL; DR; Standardising mocking throughout your code base in the simplest way possible without mixing test-only and production code. See on GitHub or below (in full) The Problem Mocking in (Apex) unit tests is very useful. There are, however, a few challenges to it. How exactly do you replace the… Read More »Class Factory
TL; DR; Apex utility wrapping DML operations and logging their results consistently. And a mock version of the same allowing to do “pretend” DML in Unit Tests. Full source on GitHub (link). The Problem Not really a problem to be honest. It started with a desire to reduce duplication in… Read More »DML (Mock) Service
TL; DR; (Fairly) efficient algorithm to organise Accounts into hierarchies in Apex and update fields in those hierarchies accurately. You can jump straight to the code if you’d like or read on. The Problem There are Account fields that need to be propagated down the hierarchy when they change (but… Read More »Account Hierarchy Update
TL; DR; Unified Async Apex base class to execute batch record processing asynchronously without having to worry (too much) about limits and how it actually executes. Intended for simpler jobs in order to ease off the pressure on trigger handlers rather than true big-batch tasks. Just keep calling executeAsync and let… Read More »Async Apex Job
TL; DR; Simple approach to fixing .invalid email addresses of selected users in newly created Sandboxes using SandboxPostCopy triggered Apex and a Permission Set. The Problem Scratch orgs are still a distant dream for many teams. Cloning a single Developer sandbox that’s been around for years and contains sort-of usable… Read More »Sandbox User Emails