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 2 Next »

Overview

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).

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.

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

Formulas

Now to define the formulae of the fields:

Name: Order Line Item – Formula Fields – Unit Price
Key: pulsar.Order_Line_Item__c.Unit_Price__c.formula
Value: 

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

 

Name: Order Line Item – Formula Field – Total Discount
Key: pulsar.Order_Line_Item__c.Total_Discount__c.formula
Value:

DEFAULT{
Action=SetVar;
VarName=PromotionDiscount;
VarValue=Product__r.Discount__c;
|
Action=SetVar;
VarName=Discount;
VarValue=Discount__c;
|
Action=SqlQuery;
QueryString=SELECT (CAST(‘%%PromotionDiscount%%’ AS REAL) + CAST(‘%%Discount%%’ AS REAL)) AS TotalDiscount;
QueryReturnFields=TotalDiscount;
|
Action=SetFieldInMemory;
FieldType=General;
FieldName=Total_Discount__c;
FieldValue=%%TotalDiscount%%;
}

 

Name: Order Line Item – Formula Field – Amount
Key: pulsar.Order_Line_Item__c.Amount__c.formula
Value:

DEFAULT{
Action=SetVar;
VarName=Amount;
VarValue=(Unit_Price__c * Quantity__c) – (Unit_Price__c * Quantity__c * Total_Discount__c);
|
Action=SetFieldInMemory;
FieldType=General;
FieldName=Amount__c;
FieldValue=%%Amount%%;
}
  • No labels