Set a Default Value for an Engraving Attribute

More Than Just Picklists

In the previous step you created two configuration attributes that were based on picklist fields. Configuration attributes can use many fields of other data types as their inspiration.

  • Checkbox
  • Currency
  • Date
  • Email
  • Number
  • Percent
  • Picklist
  • Picklist (Multi-Select)
  • Text
  • Text Area
  • Text Area (Long)
  • Text Area (Rich)
  • URL
  • Lookup

Technically, you can create Time and Date/Time attributes, but the time component isn’t visible on the Product Configuration page, so it limits how you can use them.

In this step you create a Text-based configuration attribute named Engraving. This allows customers to add a special message engraved on the underside of the smartwatch. To demonstrate the power of configuration attributes, you set up CPQ so that it defaults to the contact related to the quote.

Just like the first two configuration attributes you created in the last step, you start by creating a field on the Product Option object.

  1. Click Setup gear icon and click Setup. The Setup page opens in a new tab.
  2. Click Object Manager.
  3. Click Product Option.
  4. Click Fields & Relationships.
  5. Click New.
  6. Click Text.
  7. Click Next.
  8. For Field Label, enter Engraving.
  9. For Length, enter 100.
  10. Click Next.
  11. Click Next to keep field-level security as is.
  12. Click Save.

Good, now you have to add the API name for Engraving to the Target Field field on the Configuration Attribute object.

  1. Click Object Manager.
  2. Click Configuration Attribute.
  3. Click Fields & Relationships.
  4. Click Target Field.
  5. In the Values list, click New.
  6. Enter Engraving__c.
  7. Check the box next to Record Type Name.
  8. Click Save.
    Close the Setup tab to get back to the Salesforce CPQ tab.

Now you’re ready to create the actual configuration attribute record.

  1. In the navigation bar, click Products.
  2. Click Smartwatch.
  3. Click the Related tab.
  4. In the Configuration Attributes related list, click New.
  5. Click Next to leave the record type as Configuration Attribute.
  6. For Attribute Name, enter Engraving.
  7. For Target Field, choose Engraving__c.
    If you don’t see Engraving__c in the picklist yet, click Cancel, then refresh the page in your browser. Then go back to step 3.
  8. For Row Order, enter 10.
  9. For Column Order, choose 2.
    The Product Configuration page is divided into three columns. By choosing 2, we’re telling CPQ to put the attribute into the second, or middle, column. Choosing 3 would put the attribute into the far right column.
  10. Click Save.

Excellent, your new configuration attribute will appear to the right of the first two you made.

Product Configuration page for Smartwatch with three attributes visible

Your sales reps can manually enter text, but you want to prepopulate the attribute with known information, specifically, the name of the customer. That takes a little more work.

Use a Formula Field to Supply a Default Value

You want CPQ to populate the Engraving attribute with some data, but that raises a question: Where does the data come from? In this example, you create a formula field on the quote to supply the data CPQ needs. You start by navigating to the Object Manager in Setup.

  1. Click Setup gear icon and click Setup. The Setup page opens in a new tab.
  2. Click Object Manager.
  3. Click Quote.
  4. Click Fields & Relationships.
  5. Click New.
  6. Click Formula.
  7. Click Next.
  8. For Field Label, enter EngravingDefault.
    For this example you use a label that’s easy to remember, but when you create your own attributes there is no specific requirement for what you call the field. Just make note of the API name since you need it later.
  9. Click Text.
  10. Click Next.
  11. For the Formula, enter SBQQ__PrimaryContact__r.FirstName + " " + SBQQ__PrimaryContact__r.LastName
    This formula is a basic example of using information from the quote to make a string of text. As an admin, you can use the full power of formulas to create whatever makes sense for your business.
  12. Click Next.
  13. Click Next to keep field-level security as is.
  14. Click Save.
    Close the Setup tab to get back to the Salesforce CPQ tab.

EngravingDefault (which has an API name of EngravingDefault__c) will act as the source of default data for your text-based attribute. The last step is to tell CPQ about this data source.

  1. From the navigation bar, click Products.
  2. Click Smartwatch.
  3. Click the Related tab.
  4. From the Configuration Attributes related list, click Engraving.
  5. Click Edit.
  6. For Default Object, choose Quote.
    This tells CPQ where the field exists for the default data.
  7. For Default Field, enter EngravingDefault__c.
    It’s critical to type in the exact API name, otherwise you can’t save the configuration attribute record. Also, the data type of the Default Field must match the data type of the configuration attribute’s Target Field.
  8. Click Save.

Fantastic, your Engraving attribute will automatically populate the text with the name of your quote’s Primary Contact. You can test it by adding the Smartwatch to Q-00045, and you should see Philip Cleverham appear in the Engraving text area.

Product Configuration page for Smartwatch with Engraving field populated

Using a formula to supply a default value is a clever way to help your sales rep, but it does have a big limitation. Formula fields can only return certain data types. Since the data type of the Default Field must match the data type of the Target Field, this makes it impossible to use formulas to default certain configuration attributes, such as text areas, picklists, and email addresses.

If you want to supply a default for a field, such as an email address, you have to go about it a slightly different way. Create a normal email field on the Quote object. Then, use something like Process Builder to populate the field however you want. From that point you can follow the same last eight steps from above, but with your email field API name instead of EngravingDefault__c.

Setting a default value is a great way to give your sales rep a little guidance while helping them get quotes created even faster. In the next step we see how to create a configuration attribute that exists in a specific bundle Feature.

Resources