Versions Compared

Key

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

SFDC Validation Rules

Spring 2019 Note: Pulsar now directly supports evaluating Salesforce validation rules both online and offline.

  • Supports most SFDC formulas (see more information about formula fields)
  • Set pulsar.validation.enableSFDCValidationRules Pulsar Setting to TRUE
  • Follow the pre-processing steps on the Pulsar Settings Manager tab


...

PSL Validation Rules

Spring 2019 Note: we recommend that you use SFDC validation rules going forward, but PSL validation rules will continue to be supported.

...

Validation Rules and Trigger execution points are composed of three "post-action" execution points, OnCreate, OnSave, and OnDelete, where the create, save, or delete action has occurred or is certain to occur, and four "pre-action" execution points, BeforeConvert, BeforeEdit, BeforeSave, and BeforeDelete, where conditions can be validated before the actions occur. The differences between Validation Rules and Triggers actually have to do with the actions taken within the setting. Validation Rules will contain Alert actions that inform the user of a failed condition. Triggers will often update the current record or other records with no user interaction. Validation Rules and Triggers can be combined in Pulsar, and all of the logic for a particular object type and execution point can be contained in a single setting. 

Usage

The Validation Rules and Triggers are defined using Pulsar Settings Language (PSL). The general format for such a setting is as follows:

...

Name:  Object Name – execution point
Key:     pulsar.onCreate.<Parent Object API Name>.<Child Object API Name>.PreInit
Value:  Pulsar Settings Language

The first version (without PreInit) runs immediately after the object is created, but before the object is committed to the database (before other save triggers have a chance to run). The second version (PreInit), runs before the object is created, in case there are trigger actions that must occur before the new child object can be created, perhaps to ensure certain values are passed to the create action.

Example Validation Rule

Name:   Order - Before Edit
Key:      pulsar.beforeEdit.Order__c
Value:   See the code below. This setting executes when the user tries to edit a record, and uses a query to determine if the user attempted to update a record that is already in status "Finalized" or "Cleared". If so, it alerts the user with the appropriate message.

Code Block
DEFAULT{ 
Action=SetVar; 
VarName=Order_Id; 
VarValue=@@CurrentObjectId; 
| 
Action=SqlQuery; 
QueryString=SELECT Id FROM Order__c WHERE Id = '%%Order_Id%%' AND Status__c IN ('Cleared','Finalized'); 
QueryReturnFields=@@QueryCount; 
QueryTest=%%QueryCount%%=0; 
QueryTestTrue=SUCCESS; 
| 
Action=Alert; 
Message=Update is not allowed on Orders with status finalized, or cleared.; 
} 
SUCCESS 
{ 
}

Example Trigger

Name: On Save – Order Line Item

...