PSL Execution Triggers

PSL Execution Triggers

A PSL execution trigger is a Pulsar Setting that runs custom SQL-based logic at a defined point in a record's lifecycle, before it's viewed, edited, saved, or deleted, or after it's created, saved, or synced, to validate data or update records automatically. Pulsar supports ten execution points, from BeforeView through AfterLogin; if a Salesforce validation rule can do the job, use that first. See the pages below for setting formats, alert examples, file-object triggers, and field triggers.

PSL Execution Trigger Overview

A PSL execution trigger is a Pulsar Setting that runs custom SQL-based logic at a defined point in a record’s lifecycle, such as before a save or after login, to automatically validate data or update records.

Since PSL leverages the power of raw SQL, you can create complex validation logic that exceeds what Salesforce validation rules can offer out of the box.  Despite (or frankly because of) the power of PSL execution triggers, we recommend that you use Salesforce validation rules if possible before bringing PSL to bear on a thorny problem. Read more about Pulsar support for Saleforce validation rules for more details.

Admins can use Pulsar Settings to implement PSL execution triggers for the following execution points:

  • BeforeView

  • BeforeEdit

  • BeforeSave 

  • BeforeDelete

  • OnCreate

  • OnSave

  • OnDelete

  • onBarcodeScan

  • AfterSave (similar to OnSave, but is only run when the online save has been successfully pushed to Salesforce)

  • AfterLogin

 

PSL execution triggers are composed of four "pre-action" execution points, BeforeView, BeforeEdit, BeforeSave, and BeforeDelete and four "post-action" execution points, OnCreate, OnSave, AfterSave, and OnDelete, where the create, save, or delete action has occurred or is certain to occur, where conditions can be validated before the actions occur. There are two main use cases for PSL Execution Triggers. Some triggers will contain Alert actions that inform the user of a failed condition. This is often used for enforcing complex business logic that can run offline and create valid and clean data. Other triggers will update the current record or other records with no user interaction. Both types of 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. 

A Note about Save Triggers

To avoid issues with saving your data, we recommend using the SyncNow action only with the AfterSave trigger and not with the BeforeSave or OnSave triggers. In fact, the primary use case for the AfterSave trigger is to be able to run a SyncNow action.

The difference between OnSave and AfterSave is that OnSave executes after a successful local write and always executes. The AfterSave trigger only executes after Pulsar sends the record create/update via an online write and has received a success response from Salesforce.

 

Two additional PSL execution trigger points exist related to Sync:

  • BeforeSync

  • AfterSync

Refer to Sync Triggers for more information about these triggers.

PSL Setting Name, Key, and Value Format

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

Name:  <Object Type> – <execution point>
Key:     pulsar.<executionPoint>.<ObjectAPIName>
Value:  Pulsar Settings Language

Note: Besides this single-object format, some settings, such as AfterLogin <<add link>> and OnCreate <<add link>>, have alternative formats. See the specific setting definition for more information.

More information about PSL Execution Triggers