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.

A very responsible api developer who does not make breaking changes in their packages

Moving Metadata Between Packages

Nov 6, 202411214 min

The dangers of delayed compilation TL; DR; I’ve previously mentioned a handy way to allow moving components between packages during upgrades even up the package dependency hierarchy. It came with a caveat about Custom Labels and more importantly about LWCs components. This article is cautionary tale no. 2. Maybe it’s…

Open box with a lock and chain that was loosed, but inside some books are still locked with another chain

Not so Unlocked Packages

Apr 30, 2024111214 min

TL; DR; Hard-learned lessons using Unlocked Packages with Namespace. Well worth it when done right and when you know what to not use them for. Learn about the many things you cannot do with them below. Summary[Open][Close]TL; DR;MotivationThe Limitation of Unlocked Packages with NamespaceTests are no longer localCannot change published…

Bear with a sign, generated by DALL·E

DmlWork a.k.a. the UoW meets Triggers

Nov 1, 20238198 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, 20238107 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, 202239114 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, 20226235 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, 20224978 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, 202234710 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, 202246617 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, 202246714 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…

Load More