Writing Advanced-Calculator-Compatible Formulas

by JFeingold on ‎04-18-2016 11:32 AM

As of Spring '16, Formula Fields and Price Rule formulas may reference any fields or relationships, subject to the following three restrictions:

 

1: NON-SUPPORTED FORMULAS

  1. The following functions and variables are not supported. Formula fields that reference them will not be evaluated, and Price Rules formulas that reference them will cause calculation to fail.
    1. DISTANCE().
    2. GEOLOCATION().
    3. GETSESSIONID().
    4. Global variables, i.e. any variable beginning with $.

 

2: REFERENCING STANDARD FIELDS ON STANDARD OBJECTS

Be careful when referencing standard fields on standard objects, particularly non-Text types, as these fields may cause formulas to fail. To resolve the issue, create a formula field on the object in question that references the standard field, and reference that field in your formula instead. For example, if a reference to Account.Industry is causing a formula to fail, create a formula on Account that contains the value of Account.Industry and reference it instead. The following standard fields are universal to all Salesforce objects, and are therefore safe to use in any formula:

  1. CreatedDate
  2. LastModifiedDate
  3. Name
  4. OwnerId
  5. CreatedById
  6. CurrencyIsoCode

 

3: REFERENCING LOOKUP OBJECTS

  1. Formulas should not directly reference lookup relationships that do not originate on either the Quote, Quote Line, or Quote Line Group objects. This is best illustrated with a series of examples:
    1. The following Quote Line formulas are ACCEPTABLE:
      1. IF(Existing__c, PriorQuantity__c * ListPrice__c, Quantity__c * ListPrice__c). This formula does not reference any lookup relationships at all.
      2. IF(Quote__r.StartDate__c < TODAY(), 'PAST', 'FUTURE'). This formula references the Quote object.
      3. Product__r.Name & '  ' & Product__r.ProductCode. This formula references the Product__r relationship, which originates on the Quote Line object.
      4. Quote__r.Account__r.Name. The Account__r relationship originates on the Quote object, and is therefore acceptable.
    2. The following Quote Line formulas are NOT ACCEPTABLE:
      1. IF(Product__r;DiscountSchedule__r.IsCrossOrders__c, 'Hooray', 'Boo'). The DiscountSchedule__r relationship originates on the Product object. To resolve this issue, create a formula field on the Product object that references DiscountSchedule__r.IsCrossOrders__c, and reference that field instead. For example, IF(Product__r.IsDiscountCrossOrders__c, 'Hooray', 'Boo').
      2. Quote__r.Opportunity2__r.Contract__r.Description. The Contract__r relationship originates on the Opportunity object. To resolve this issue, create a formula field on the Opportunity object that references Contract__r.Description and reference that field instead. For example, Quote__r.Opportunity2__r.ContractDescription__c.

NOTE: These three restrictions apply to all fields that satisfy both of the following criteria:

  1. The field exists on the Quote, Quote Line, or Quote Line Group object.
  2. ONE OR MORE of the following are true:
    • The field is displayed in the Line Editor.
    • The field is referenced by a Quote Calculator Plugin.
    • A Price Condition references the field in its Tested Formula or Filter Formula, or uses it as a Tested Field.
    • The field is used as the Tested Field of a Lookup Query.
    • A Price Action uses the field as its Source Field, or references it in its Source Formula.
    • The field is used as the custom quantity field for a Block Price or Discount Schedule.
    • The field is used as the constraint field of a Discount Schedule.
    • A Summary Variable uses the field as its Aggregate Field, Filter Field, or Constraint Field.
    • The field is referenced by another field that satisfies one or more of the above criteria within this bulleted list.
Comments
by EJ
on ‎08-05-2016 07:51 AM

The end is a bit confusing:

 

"These 3 restrictions": I only see 2 numbered points above and below that statment.

 

The final list 1 and 2 seems to be explaining if the criteria are met, than you can use them in a formula. Correct?

by eching
on ‎09-07-2016 12:16 PM

We are using references to lookup object in production and this update prevents us from using later patches of Steelbrick.  When speaking to my Success Manager, he let me know that this is only applicable to the advanced calculator.  However when we ran testing in our development instances it is still impacting the legacy calculator.  Can you please test this and let me know a path forward as this hinders our usage of steelbrick. 

Contributors