Dev Tips
MISSING SUBTEXT

CPQ's Most Underrated Feature: Twin Fields

How to use Twin Fields and Special Fields for Salesforce CPQ

December 3, 2021

Today we are going to talk about one of the most underrated features CPQ has that people should know more about: Twin Fields. We’re also going to mention their cousin: Special Fields.

When we first heard about this feature it reminded us of Quote Sync on Sales Cloud. In fact, Twin Fields and Special Fields bring much more features to what Quote Sync supports. Normally, Quote syncing copies values and products from the Opportunity record it was created from in terms of standard fields and line items. However since you can have more than one Quote linked to an Opportunity record, you can only sync one Quote at a time and you cannot sync custom line item fields as of yet. (By the way, you can vote for this feature here).

You also cannot sync products that have an inactive list price or Pricebook or Product. You would need to edit them as active or delete them if they’re selected as archived. One common error is having an inactive currency left in a multi-currency org and sync a record with that currency. If you have any approval processes currently pending on a quote, you cannot sync another one until the process interview finishes executing.

In CPQ, certain pairs of CPQ objects pass custom field values from the first object to the second object when the second object is created. The values pass if the custom fields are editable, have matching field types, and have matching API names. We call these field pairs “twin fields.” You can one way map these values between supported objects, including custom fields. You would need to have a Read access on the source field and Edit access on the target field. Standard fields can’t be mapped between objects.

Objects in Column 1 of this table pass field values to custom fields with matching types and API names from the objects in column 2.

Column 1 Column 2
Contract Opportunities made from amending or renewing the contract
Service Contract Opportunities made from amending or renewing the service contract
Opportunity Products Quote Line

Salesforce CPQ maps from opportunity products to quote lines only for standalone products and only when opportunity products have been created before a sales rep creates the opportunity’s first primary quote.
Product Quote Line
Product Option Quote Line

If a product and product option both have the same field as a related quote line, the quote line field inherits the value of the product option field.
Quote Order

The quote’s Payment Terms field is an editable picklist field, while the order’s Payment Term field is restricted to a global picklist value set. If an admin adds a custom picklist value to the quote’s Payment Term field, and then a sales rep order the quote, Salesforce CPQ encounters an error.
Quote Line Order Product
Quote Line Opportunity Product

Salesforce CPQ maps twin field values from the quote line to the opportunity product when the quote line is created and any time that the quote line record is updated.
Quote Line Subscription
Quote Line Assets
Quote Line Contract Line Item
Subscriptions Quote Line

On amendment quotes, quote lines inherit twin field values from the first subscription record, not any amended subscriptions made from that record.
Contract Line Item Quote Line
Order Product Invoice Line
Asset Quote Line

Salesforce CPQ maps from the asset back to the quote line only during amendment and renewal processes when quote lines are generated from assets.


In terms of where you would need to use Twin Fields depends on if you regularly update the same values from an object via automation or with Apex in Salesforce. Instead of building these customizations you can use Twin Fields to map data across supported objects and yourself platform resources. This feature can especially be a lifesaver in a large volume data org. A great example of using a Twin field is when you have a field value copied from a Product copied across all Quote Line Items it’s generated from. This feature also does not require you to activate it on setup. You can simply use it by following the conditions listed above.

The potential drawbacks for this mapping is that you need to work with standard objects since Custom Objects are not supported and check the objects you will be using are supported. You need to also have the exact API name, not the labels. One common mistake is to have different field types since this is also not supported. 

Picture of gears


When a bundle is configured, objects in Column 1 transfer their values to the emerging new quote lines. When you access the configurator to reconfigure the bundle, Salesforce CPQ sets product options and configuration attribute values based on matching field values from their related quote lines.

Note: If you mark a bundle a Favorite and then add that favorite bundle to the quote line editor, it won't seize any twin field values.

Tip: If your twin fields are not mapping from one object to another, go to Setup>Quick Find>Installed Packages and click the Configure link next to the Salesforce CPQ package. Then, go to the Additional Settings tab and try taking the "Post Install Steps" by clicking Execute Scripts and retesting your twin fields. Source: (Also shoutout to John Garvens!)

Another key point is that twin fields are populated only upon record creation, so editing the source will not copy the value to it’s target. 

The below diagram shows the mapping direction between Twin Fields on various objects that happen in Salesforce CPQ and Salesforce Billing at certain automation.

Twin Fields Diagram


We also need to talk about Special Fields here which are fields you can create to unlock advanced features of the CPQ package. Here’s a list of CPQ Special Fields you can use to aid your CPQ implementation.

For example you want to customize Quote fields in the Quote Line Editor for different users: Can the 'Line Editor' field set on Quote be customized for different users? This is for Quote, not Quote Lines. The desired outcome is one group of users see a certain set of Quote fields, whereas another group see different Quote fields when configuring a Quote.

The answer is yes: With the Salesforce CPQ Special Field, HeaderFieldSetName, you can create a field on the quote object to dynamically display a specific quote field in the quote line editor. You can choose to control the quote field set that is displayed by using a formula field or you can allow users to make their own selection by using a picklist field.

Here are the necessary steps:

  1.  Navigate to the Quote Object.
  2.  Create new Field Sets as necessary.
  3.  Create a New Picklist Field on the Quote Object.
  4.  Set a Field Label.
  5.  Set Field Name to HeaderFieldSetName.
  6.  Input picklist values, these must be the API names of the Field Sets you created on the Quote Object (Remember: Field Set API Names do not contain  "__c").
  7.  Return to the Quote Object.
  8.  Edit the Line Editor Field Set and include the new field.
  9.  Include the HeaderFieldSetName field on all field sets in the picklist.
  10.  Click Quick Save. Notice the Field Set has changed.

NOTE:

  • "Quick Save" must be clicked in order for the user to see the change of the quote line Quote fields. In addition, setting the picklist value back to "--None--" and clicking "Quick Save" will return the UI to the "Line Editor" Field Set.
  • If the HeaderFieldSetName field is not selected in the field sets or displayed in the quote line editor, the value can be edited from the quote record.
  • Invalid field values used in the HeaderFieldSetName will result in zero fields displayed in the quote line editor. 
Field Object/Location Data Type Description
AdditionalDiscountUnit Quote Line Picklist The value entered for this picklist field will change the unit of an additional discount entered on the Quote Line. Default recommended picklist values are Percent, Currency, Unit, and Total.
AdditionalInstructions Product Feature Text Create a text field with this name and populate it on a given Product Feature record, and it will display the instructions/help text to the user when configuring the bundle.
ApplyAdditionalDiscountLast Quote Formula as number Apply the 'Additional Discount' last in the price waterfall (Internal Pricing Logic).
ApplyPartnerDiscountFirst Quote Formula as number ApplyPartnerDiscountFirst calculates the partner discount off List Price, then any automatic discounts, and manual additional discounts last.
ApprovalsArchived Quote Formula as number This field can be set to a value of 1 to prevent approval records from being deleted from the approvals Related List when using advanced approvals.
ChannelDiscountsOffList Quote Formula as number ChannelDiscountsOffList calculates all discounts off List Price without calculating them sequentially.
ChannelDiscountsOffList Quote Formula as text Allows you to populate with a Salesforce ID from an account that contains a Contracted Price you would like to use (generally using a Workflow Rule). For example: if you want to set up logic that says "no matter if this Quote is direct or channel, use the direct Contracted Price", this is how you accomplish that.
ContractGroup Contracts Text This field can be used to combine active contracts on an account to renew and co-terminate onto a single renewal opportunity.
CustomActiveContract Contracts Checkbox Indicates which contracts to use as active in a renewal process.
CustomName Quote or Quote Document Formula as text The value returned from the formula can be used to modify the name on the Quote Document.
DefaultSalesRepID Quote Formula as text Automatically populates the Sales Rep field on quotes when it is blank.
DocumentCurrencySymbol Quote Formula as text Create a text formula that returns a currency symbol based on the Currency ISO code to display the desired symbol instead of the ISO code in the document output. For example: CASE(CurrencyIsoCode, "EUR","€", "GBP","£", "$").
EditLinesFieldSetName Quote Formula as text or Picklist Dynamically displays different columns for fields in the Edit Lines page based on type of user or quote. See Dynamic Edit Lines Page for instructions. If you want different users to see different fields or columns on the Edit Lines page based on the type of user or type of quote, set up the EditLinesFieldSetName field to apply different field sets in different scenarios.
ForceDeferred Contract Formula as number Change the process triggered from setting Renewal Forecast to True from synchronous to asynchronous.
HeaderFieldSetName Quote Formula as Text or Picklist Dynamically displays quote fields on the quote line editor based on the type of user or quote. See Dynamic Display Salesforce CPQ Quote Fields in the Quote line Editor for instructions. To show different quote fields based on the type of user or type of quote, set up the HeaderFieldSetName field to apply different field sets in different scenarios. NOTE: Dynamic display of Quote fields using HeaderFieldSetName must have the field type as picklist or formula. The feature doesn't work with field type set as Rich Text Area.
IncludePriorQuantity Quote and Subscription Formula as Checkbox Include prior quantity of a Subscription product for use in calculating Discount Schedules with Cross Orders enabled.
LineSortField Quote Formula as Number or Text Automatically sort Quote Lines in the Line Editor in the same order as the products appear on the configuration page.
Markupunit Quote Line Picklist Custom picklist allowing for markups to be either by percent or amount.
OverageRate Block Price Currency Allows you to enter an overage rate for block prices, which is added on top of the block price selected and calculated by taking the difference between the minimum quantity for the block and the quantity entered for that line item.
ProrateAmountDiscounts Quote Line Formula as Number Allows you to configure quotes to have the total quote amount represent discount per unit of quantity and discount per unit of term. For example, you may want to apply an annual discount to a subscribed product that has 6 months remaining on the term.
QuotePrimaryContact Opportunity Formula as text Override default Primary Contact Mapping from Oppty to Quote.
QuotePrimaryPartner Opportunity Formula as text Salesforce CPQ designates the Quote-level Primary Partner record by looking at the Partner record marked Primary in the partner Opportunity's Partner Roles related list. If QuotePrimaryPartner contains a Partner record ID, Salesforce CPQ will use that value instead for copying to the Quote's Primary Partner field.
UnitPriceForceOverride OrderItem Currency Provides the ability to override the Unit Price of an Order Item. NOTE: This special field is not supported for Salesforce Billing.


More like this