Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • If there is both a Salesforce formula and a PSL formula for the same field, the PSL formula takes precedence, and the Salesforce formula is ignored
  • Salesforce formulas and PSL formulas across objects/fields should not interact (e.g., if FormulaFieldA__c is a Salesforce formula and FormulaFieldB__c is a PSL formula, the result is undefined if they reference each other).
  • Formula fields are calculated on-the-fly every time you view a record detail page (but not when editing)
  • Formula Currently due to processing limitations, formula fields are NOT calculated in list views.  The Stale values showing may be shown in the list view may not match the latest information unless you perform a step to persist the calculation to the local database list views unless steps are taken to persist calculations (see below).

...

Offline persistence of formula field values

Due By default, due to inherent processing limitations, by default formula field calculations are not persisted to the local database when offline.

This is often not a problem for organizations for various reasons.  For many organizations, formula fields are only ever interacted with when on record detail pages (where these formulas are always dynamically calculated).  Furthermore, formula field calculations are not synced from Salesforce servers and persisted to the local database when online during record creation and updates, or when Pulsar next syncs those created/updated records.  When online, there is always a readback that picks up server-side calculations.

But for some organizations, when running offline , this in Pulsar, the lack of persistence of formula field calculations can present a "stale data" problem if formula fields are problem.  This is usually due to the following two scenarios: (1) formula fields present in list views, and (2) customizations that directly query formula fields from the database (e.g. querying via PSL or via the Javascript API).

Luckily there is a mechanism from PSL to calculate and persist formula fields if you are querying the database for formula fields.do encounter stale data problems.

Code Block
DEFAULT{
Action=CalculateSaveFormulas;
ObjectType=<ObjectAPIName>;
ObjectIds=<Optional comma-separated list of object Ids. If empty/unspecified, will operate on all records of ObjectType>;
WhereClause=<Optional WHERE clause to programmatically select specific Ids>;
FormulaFields=<Optional comma-separated list of fields.  If empty/unspecified, will operate on all formula fields of the ObjectType>;
}

For example, if you want to ensure that all formula fields on the Account object are always kept up-to-date in the local database, you may wish to create an OnSave PSL Validation Rule (see the next section in the wiki).

Code Block
DEFAULT{
Action=CalculateSaveFormulas;
ObjectType=Account;
ObjectId=,;
}



...

PSL Formulas

Spring 2019 NOTE: we recommend that you use SFDC Formulas going forward, but PSL formulas will continue to be supported.

...