Skip to content
Home » Pragmatic Bear’s Salesforce 201

Pragmatic Bear’s Salesforce 201

I write about the things I work on, often as I work on them. You can find reusable utility code or explanations of my process. Many times there is no clear end and a lot of further work is required. Code samples are usually included. Where it makes sense I include full (sometimes directly deployable) code bundles via GitHub.

Bear with a sign, generated by DALL·E

DmlWork a.k.a. the UoW meets Triggers

Nov 1, 20236388 min

TL; DR; Building a neat UoW wrapper for compounding standalone service methods effectively and merging the Unit of Work approach together with updating SObject instances in Triggers. Full code on GitHub. Overloaded Often I need to call the same logic from multiple contexts. Typical example would be Before Trigger logic…

Image of the DFA approach to analysis of Salesforce Graph Engine

SFDX GitHub Code Review – Part 3

Jan 23, 20235597 min

TL; DR; Finally making the automated SFDX Pull Request Code Review useful by handling unlimited comments without API Rate Limiting issues, no comment duplication and mainly support for the fancy new Salesforce Graph Engine. A few months back the result of this series was tagged in a GitHub conversation about…

Custom lightning-input-field

Custom lightning-input-field

Dec 6, 202223214 min

TL; DR; Allowing the Label and Helptext of lightning-input-field to be customised while maintaining all the other standard features as part of a record-edit-form. Long story, mostly solved, long way still to go. Setting the Scene A very interesting challenge came my way recently. We have a custom (fairly complicated)…

Test Execution Dashboard

Test Execution Dashboard

Nov 30, 20224475 min

TL; DR; Tool to help with monitoring Test Execution time as you go through development or refactoring intended to encourage writing faster tests and catch things that slow you down. Source here. Problem Well not really a problem necessarily. Imagine you are working in an org that’s been around for…

Deleting Test Results via CLI

Deleting Test Results via CLI

Oct 17, 20223168 min

TL; DR; Clearing Test Execution History from a Sandbox automatically as a workaround to a known issue with CLI failing to read Test Results with “Cannot read properties of undefined (reading ‘Status’)” error. A lesson in misdirection by expectation and the need for attention to detail in troubleshooting. Context In…

Units of Fun

Units of Fun

Oct 4, 202219010 min

TL; DR; 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. Problem The Unit of Work is perhaps the easiest concept from the Enterprise Patterns to grasp and adopt (maybe after Selectors actually). I’m…

Query Caching with Selectors

Query Caching with Selectors

Aug 1, 202228917 min

TL; DR; Building a flexible SOQL query result cache usable with Enterprise Patterns’ Selectors. Skip to code here. Problem We had an existing static cache implementation that I wasn’t very happy with. It was a fairly simple approach, but very repetitive. Imagine a class full of static Maps (one for…

CCTV camera image

Trigger Performance – Monitoring

Jul 14, 202229014 min

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…

plan

Trigger Performance – The Battle Plan

Jun 29, 202228010 min

TL; DR; Analysing performance issues in triggers and preparing a strategy for effective improvements. The Problem “We can’t save more than x records at the time.”  “Every now and again we get this locking error.” ”It’s so slow today I can’t get anything done.”  I’ve been here many times before.…

SFDX GitHub Code Review – Part 2

SFDX GitHub Code Review – Part 2

May 20, 202236111 min

TL; DR; Finding the right “position” in the diff view for a GitHub Review Comment from a line number in static analysis report. Current version of the GitHub Action is published. Help me test and improve it. The Scene You can read how this all started in my previous post.…

Load More