Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 7 Next »

Overview

2019 February Note : Pulsar now directly supports evaluating Salesforce formulas in formula fields, even while offline.  We support all numeric, logical, string, and date/time operators and functions, and most summary and advanced functions.  Please see https://help.salesforce.com/articleView?id=customize_functions.htm.  Formulas written in Pulsar Settings Language (PSL) will continue to be supported, but you should attempt to use Salesforce formulas for all new development.  Thank you!

Information below is DEPRECATED February 2019.

The Salesforce Formula engine that processes formula fields and default value formulas is not available to Pulsar when operating offline, so Pulsar cannot rely on it for maintaining formula fields and default values. For this reason, Pulsar provides this functionality via a group of flexible Pulsar Settings that define the fields affected, the order in which they are processed, and the formula logic for each field. The formula logic is implemented using Pulsar Settings Language (PSL). Just as in Salesforce, 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.

Please note that regardless of the values calculated for formula fields in Pulsar, if the same field has a formula defined on Salesforce, the Salesforce formula supersedes the Pulsar formula when the record is synced to the server.

Usage

Formula fields and default value formulas follow an identical pattern when defined using Pulsar Settings. For each affected object or record type:

  1. Specify which fields to process and the order in which they should be processed (Field Order Settings)
  2. Describe the logic or calculation that must occur (Formula Settings)

Field Order Settings

The formula field order and default value field order settings both allow you to specify a list of field API names separated by commas, newlines, or semicolons. The setting key optionally allows you to narrow the scope to a specific record type. 

Formula Field Order Setting Format

Name: Object Name – Formula Field Order
Key: pulsar.<object API name>[.<record type developer name>].formulaFieldOrder
Value: Field1APIName, Field2APIName, Field3APIName, ...

Example:

Name: Order Line Item – Formula Order
Key: pulsar.Order_Line_Item__c.formulaFieldOrder
Value: Unit_Price__c,Total_Discount__c,Amount__c

Default Value FIeld Order Setting Format

Name: Object Name – Default Value Field Order
Key: pulsar.<object API name>[.<record type developer name>].defaultValueFieldOrder
Value: Field1APIName,
           Field2APIName,
           Field3APIName,
           ...

Example:

Name: Cheque - Default Value Order
Key:  pulsar.Cheque__c.CashierCheque.defaultValueFieldOrder
Value: Cheque_Date__c,
            Cheque_Number__c 

Formula Settings

Defining the formulas associated with the default value or formula fields requires using PSL. The only requirement is to use the SetFieldInMemory action to set the resulting value to the field in question. The setting key optionally allows you to narrow the scope to a specific record type, as with the field order settings above.

Formula Field Formula Setting Format

Name: Object Name – Formula Field – Field Name
Key: pulsar.<object API name>[.<record type developer name>].<field API Name>.formula
Value: Pulsar Settings Language

Example:

Name: Order Line Item – Formula Fields – Unit Price
Key: pulsar.Order_Line_Item__c.Unit_Price__c.formula
Value: See the code below. Notice that the last action is the SetFIeldInMemory action.

DEFAULT{
Action=SetVar;
VarName=UnitPrice;
VarValue=Product__r.Unit_Price__c;
|
Action=SetFieldInMemory;
FieldType=General;
FieldName=Unit_Price__c;
FieldValue=%%UnitPrice%%;
}


Default Value Formula Setting Format

Name: Object Name – Default Value Field – Field Name
Key: pulsar.<object API name>[.<record type developer name>].<field API Name>.defaultvalue
Value: Pulsar Settings Language

Example:

Name: Cheque – Default Value Field – Cheque_Date__c

Key:  pulsar.Cheque__c.CashierCheque.Cheque_Date__c.defaultValue
Value: See code below. Notice that the last action is the SetFIeldInMemory action. 


DEFAULT{ 
Action=SetVar; 
VarName=ThisDay; 
VarValue=@@Today; 
| 
Action=SetFieldInMemory; 
FieldType=General; 
FieldName=Cheque_Date__c; 
FieldValue=%%ThisDay%%; 
}
  • No labels