This package contains a set of Apex utility classes providing features often missing when implementing custom logic in Apex.
These components were built as contributions/examples for former & ongoing Advisory assignments by Pierre-Emmanuel Gros.
External links towards interesting Apex frameworks are alsdo referenced here.
ℹ️ The current version is a full re-packaging of the previous repository as modular unlocked packages. The previous version remains available in the v0 branch and will no longer evolve.
The PEG_APEX package provides a set of Apex utility classes, grouped by purpose in separate folders (corresponding to distinct unlocked packages). Detailed informations about these utilities (behaviour, usage, technical details) are available in their own help pages.
The sfpegDebug_UTL Apex class enables to optimise and homogenize System.debug() statements within
Apex code. Its primary objective is to keep all detailed debug statements in the Apex code to support
any investigation on a production Org when necessary, without having too much performance impact coming
from implicit data toString() serializations.
The sfpegQueueable_UTL Apex class provides various utilities to manage asynchronous Queueable Apex processes: Singleton process execution control (e.g. triggered from Apex trigger), aggregated Queueable execution statistics logging and aggregation.
This is an add-on to the sfpegQueueableUtility package by extending the Queueable Log record page with a set of PEG_LIST actions and related lists to ease supervision of the Queueable processes.
The sfpegSharingGroup_UTL Apex class provides a generic Apex logic for Queueable processes to manage Public Groups linked to a hierarchical Structure object to be used for Apex Sharing (local, upwards or downwards to each Structure record) and manage User Structure assignments.
The sfpegCampaign_UTL Apex utility class (called from Campaign and CampaignMember Apex triggers) enables to implement some usual business logic missing in standard Salesforce for Campaign management.
Each Apex Utility is packaged independently as an unlocked package. Some are completely standalone (e.g. sfpegDebugUtility) while others have dependencies (e.g. sfpegQueueableUtility depends on sfpegDebugUtility and sfpegSharingGroupUtility on sfpegQueueableUtility).
Each package basically contains the Apex utility class(es) as well as some supporting metadata (Apex test class, custom setting, custom object, permission set...).
- see Success Cloud Coding Conventions on Trailhead.
Various Frameworks are available to structure Trigger logic and ensure logic bypass on demand. Some interesting solutions are available here:
Logging some transactions may be required on a permanent basis to monitor the platform (i.e. not for debug), possibly in addition to standard Shield Event Monitoring feature. Some interesting solutions are available here:
- The Salesforce Inspector Reloaded chrome extension is the ultimate tool to deal with data and metadata from the Salesforce UI.
- The SFDX Data Move Utility plugin for the Salesforce CLI is very useful to seed data within dev sandboxes from a reference Org (prodiction, full sandbox...).
