Versions Compared

Key

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

...

  • If there is both a Salesforce formula and a Pulsar Settings Langugae (PSL) formula (see below) 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)
  • Currently due to processing limitations, formula fields are NOT calculated in list views.  Stale values may be shown in list views unless steps are taken to persist calculations (see below).

...

Luckily there is a mechanism from PSL (as well as the Javascript API, documented elsewhere) to calculate and persist formula fields if you do encounter to explicitly avoid 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>;
}

Let's say, for example, you want to ensure that all formula fields on the Account object are always kept up-to-date in the local database.  You can create an OnSave PSL Trigger (see the next section in the wiki about PSL Validation Rules and Triggers).  The following example PSL may will accomplish that:

Code Block
DEFAULT{
Action=SetVar;
VarName=Account_Id;
VarValue=@@CurrentObjectId@@;
| 
Action=CalculateSaveFormulas;
ObjectType=Account;
ObjectIds=%%Account_Id%%;
}

WARNING: his this can be an incredibly expensive operation if you do not specify any filter criteria.  In the example above, had we not specified the ObjectIds parameter, then the calculation and persistence would run on all Account records!


...

PSL Formulas

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

Pulsar originally Originally, Pulsar did not support evaluating SFDC Salesforce formulas, and instead offered similar functionality through logic implemented in Pulsar Settings Language (PSL).

Because PSL leverages the power of raw SQL, you can create complex formula logic that exceeds what Salesforce formulas can perform.  We recommend that you use Salesforce formulas where possible, and only use PSL formulas if you absolutely need to.

PSL Formulas are implemented via a group of flexible Pulsar Settings that define the fields affected, the order in which they are processed, and the formula logic in PSL for each field.  Just as in Salesforce formulas, default values are used during record creation and formula fields are used to calculate the proper values for fields throughout the life of the record.

...