The Decorator Pattern in Salesforce | Design Patterns | Salesforce

Credits : Amit Singh

It attempts to solve the issue where you need temporary fields for processing (typically in Visualforce/LWC/Aura) but does not need to add these fields to the sObject.

Common uses for this pattern include:

  1. Selection Checkbox — a list of records that the user selects and applies behaviour to; the selection checkbox is not saved
  2. Calculated fields — a complex read-only value that cannot be easily done in a formula field (e.g. calculation of a check digit)
  3. Wrapper Class - When we wanted to store the data from multiple related or unrelated object

Responses

Popular Salesforce Videos