Estimate Pricing Variable Overview

Pricing variables enable you to define formula-based pricing logic for custom pricing methods without writing Apex code. Each pricing variable belongs to one estimate pricing method and is evaluated when the pricing method calculates values.

The pricing method's pricing approach determines what a formula calculates and the record that it is evaluated against:

  • Under the Roll Up pricing approach, the formula calculates the bill amount for each role request, in the same way as the Cost Plus and Time and Materials pricing methods.
  • Under the Spread Down pricing approach, the formula is evaluated once for each priced parent record to calculate a single total, and that total is shared down to the role requests beneath it. For more information, see Top-Down Pricing Overview.

You create and manage pricing variables in a window opened from the Estimate Pricing Variables tab, or from the Pricing Variables related list on an estimate pricing method record. When you open the window from an estimate pricing method record, the Estimate Pricing Method field is populated and read-only. For more information, see Managing Pricing Variables.

You cannot delete a pricing variable that is referenced by another variable's formula.

Note:

When formulas are applied, and a formula references a numerical field with no value, the result is treated as zero. This applies whether the field has no value directly or because the related record does not exist. For other field types, a null value remains null.

Formula Syntax

To reference another pricing variable in a formula, use the syntax $VariableName$, where VariableName is the name of the sibling variable. Formulas can be up to 3,900 characters long.

Variable names cannot contain the $ character, and names must be unique in a pricing method. Additionally, a pricing variable cannot reference itself in its own formula.

Note:

Formulas follow standard Salesforce syntax, excluding the specific variable reference format defined above.

Formulas can also reference Salesforce formula fields. The pricing engine resolves the underlying field dependencies of formula fields automatically at evaluation time.

Pricing Variable Output

You can designate one pricing variable per pricing method as the output variable by selecting a value in the Output To field. The output variable must use the Decimal data type.

Note:

Once a pricing variable is referenced by another variable's formula, its Name and Data Type fields become read-only.

Salesforce formula fields

Pricing variable formulas can reference Salesforce formula fields. The pricing engine resolves the underlying field dependencies of each formula field recursively at evaluation time, including cross-object formula field references.

To create or edit a pricing variable formula that references a formula field, you must have read access to the formula field itself. You do not need read access to the base fields that the formula field depends on.

Formula Base Object

A formula is written against the object that its pricing method is selectable on. For a Roll Up method, this is the role request. For a Spread Down method, it is the estimate product instance or the estimate, depending on where you have made the method selectable. The Add Field window offers the fields of that object and its related records.

A formula cannot reference the bill amount that it produces, or any field calculated from that bill amount, because such a formula could never settle on a value. These fields are not offered in the Add Field window, and if a formula references one of them you cannot save the pricing variable.

Formula validation

Services Estimator validates a pricing variable formula against the following rules when you save it.

Relationship depth

Formulas can reference fields up to five levels of related records deep, counted from the object that the formula is written against. If the formula's resolved field references exceed this limit, you cannot save the pricing variable.

The Add Field window in the formula editor hides formula fields that would push the total path beyond five levels, preventing the creation of formulas that exceed this limit. Roll-up summary fields are shown as selectable terminal fields in the window.

Warning:

To create or edit a pricing variable formula, a user must have read permission on every field the formula references. Users applying pricing methods using these formulas do not require permission to every field referenced in the formula.

Pricing Field Configuration

Estimate Pricing Field records define which fields appear in the pricing method configuration and whether each field is editable. Each Estimate Pricing Field record belongs to one Estimate Pricing Method record, and access is controlled by the parent record's sharing rules. You create and edit Estimate Pricing Field records in a window opened from the Field Configurations related list on an estimate pricing method record, with the Target Field picker showing only the fields that exist on the selected Target Object. You can view and edit these fields for an estimate product instance from the Pricing tab, where records that are independent of estimate products are displayed in their own row at the bottom of the grid.

Notes:
  • The value in Target Field must be the API name of a field that exists on the selected Target Object. If the field does not exist on the target object, you cannot save the record.
  • Relationship fields cannot be marked as editable. If Target Field refers to a relationship field and Editable is selected, you cannot save the record.
  • You cannot configure the same Target Field more than once for the same estimate pricing method.

You can disable pricing field validation using the Bypass Estimate Pricing Field Trigger setting in Services Estimator Process Settings.