Versions Compared

Key

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

...

  1. BeforeView (available in 14.0+)

  2. BeforeEdit

  3. BeforeSave 

  4. BeforeDelete

  5. OnCreate

  6. OnSave

  7. OnDelete

  8. onBarcodeScan

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

  10. AfterLogin

Validation Rules and Trigger execution points are composed of three four "post-action" execution points, OnCreate, OnSave, AfterSave, and OnDelete, where the create, save, or delete action has occurred or is certain to occur, and four "pre-action" execution points, BeforeView, 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. 

A Note about Save Triggers

To avoid issues with saving your data, we recommend not 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.

Usage

Pulsar Setting Format

...

Note, besides this single object format, the OnCreate setting also supports a parent/child format. See OnCreate Trigger section below for more information.the AfterLogin and OnCreate settings have alternative formats. See sections below for more information.

AfterLogin Trigger

The AfterLogin trigger executes upon navigating to the home screen after signing in or tapping the username to start your session.

Setting Format:

Name:  After Login Trigger
Key:     pulsar.afterLogin
Value:  Pulsar Settings Language

Here is an example setting that displays an alert after the user signs in indicating whether the last sync performed was successful or not.

Code Block
DEFAULT{
Action=SetVar;
VarName=X;
VarValue=@@LastSyncSuccess;
|
Action=SqlQuery;
QueryString=select case when '%%X%%' = 'TRUE' then 1 else 0 end as Success;
QueryReturnFields=Success;
QueryTest=%%Success%%==1;
QueryTestTrue=Success;
|
Action=Alert;
Message=Your last sync failed, please try to sync again. If this continues, please contact your administrator;
}

Success{
Action=Alert;
Message=Last sync was successful!;
}

OnCreate Triggers

The OnCreate trigger executes whenever the plus button is tapped. There are two separate execution points that override the plus button on the listviews or on a specific child related list (see below for these two formats). When this setting is specified, the standard behavior to show the object in create mode is overridden with custom PSL code. This means that the PSL must ultimately handle how to respond to the plus button tap. For example, if the standard behavior is needed, the 'CreateAndMapFields' PSL action should be called as the last action in the custom PSL.

...

Code Block
DEFAULT{ 
Action=SetResult;
Result=Service Appointment viewing access denied.;
ResultValid=false;
}

...

Example

...

Triggers

Name: On Save – Order Line Item

...

Code Block
DEFAULT{
Action=SetVar;
VarName=Order_Id;
VarValue=Order__c;
|
Action=SqlQuery;
QueryString=Select SUM ( CAST( Amount__c AS REAL ) ) AS SUM_ORDER_AMOUNT FROM Order_Line_Item__c WHERE Order__c = ‘%%Order_Id%%’;
QueryReturnFields=SUM_ORDER_AMOUNT;
|
Action=SqlQuery;
QueryString=Update Order__c SET Sub_Total__c = ‘%%SUM_ORDER_AMOUNT%%’ WHERE Id = ‘%%Order_Id%%’;
}

Name: After Save - Service Report

Key: pulsar.afterSave.servicereport
Value: See the code below. The following example executes a single object sync in order to refresh the object and it’s related objects from Salesforce.

Code Block
DEFAULT{
Action=SetVar;
VarName=X;
VarValue=@@CurrentObject.ParentId;
|
Action=SyncNow;
SyncType="single";
RootObjectId=%%X%%;
}

Special File Meta Object Usage for beforeSave and onSave

...