Salesforce CPQ: Creating Dynamic Custom Actions

  • Blog
  • Salesforce CPQ: Creating Dynamic Custom Actions
blog image
24
Nov

We have already discussed that if you want to make sure that a subset of Products is displayed with the help of a button on the Quote Line Editor, you have to implement a Custom Action. This functionality can be further expanded to make it dynamic. For example, only certain products could be displayed based on any value on the quote, or any value from the opportunity, or any value from the Account. This is possible with the help of two objects: Custom Actions and Search Filters.

Let's try to create a button on the Quote Line Editor to show only products you can sell to certain companies based on the Industry field on the Account record, for example, to educational institutions.

Step 1. First, let's create a new custom picklist field with the label EdInst Suitability on the Product Object in Setup > Object Manager to specify which products can be sold to educational institutions. Select Enter values, with each value separated by a new line in the Values section and type Yes in the text box.

Salesforce CPQ New Custom Field Labels, Values and Checkboxes

Step 2. Go to Object Manager in Setup and update the Label picklist field on the Custom Action object by adding the value Add Dynamic to the Values list.

Salesforce CPQ Add Picklist Values Overview

Step 3. Update the EdInst Suitability field on the necessary product records by selecting the Yes value.

Salesforce CPQ Product Information Fields, Checkboxes and Picklists

Step 4. Create the Add Dynamic button that would take the user to the Product Selection page and is visible on the Quote Line Editor. Click New on the Custom Action tab and enter the following values:

  • For the Name field, enter Add Dynamic
  • For the Display Order field, enter 20
  • For the Type field, select Button
  • Check the Active checkbox
  • For the Page field, select Quote Line Editor
  • For the Location field, select Quote/Group
  • For the Action, select Add Products
  • For the Label field, select Add Dynamic value, which was added in the previous step.

Salesforce CPQ New Custom Action Information and Layout Fieldsets

Step 5. Create three search filters related to this custom action that correspond to the standard search functionality for Product Code, Product Name, and Product Family. 

Salesforce CPQ Search Filters for Custom Action-Add Dynamic

In the Related tab of the newly created Custom Action click New and for each filter select the Target object: Product, while the Target Field should correspond to the Name of the filter, for example, Product Code for the Product Code Search filter, etc. The operators to be used are as follows:

  • Starts with for the Product Code Search Filter
  • Contains for the Product Name Search Filter
  • Equals for the Product Family Search Filter

Salesforce CPQ New Search Filter Fieldsets

Step 6. Create a custom formula field with the label Education Institution on the Quote object that would return the value Yes if the Industry field on the related Account is set to Education.

Select Text for the Formula Return Type and enter the following formula: 

IF(ISPICKVAL(SBQQ__Account__r.Industry, "Education"), "Yes", "")

Note that the else option is two quotation marks with nothing in between.

Copy the API name of this field because we'll need it for the next step: Educational_Institution__c.

Step 7. Update the Filter Source Field picklist on the Search Filter object in Setup > Object Manager by adding the API name of the Educational Institution field we copied in the previous step to the Values list. Also, edit the Field Dependencies for the Filter Source Object by clicking Change next to the Controlling Field of Filter Source Object in the Picklist Options section. Select Educational_Institution__c under the Quote column and click Include Values.

Salesforce CPQ Field Dependecy Buttons

Step 8. Similarly, update the Target Field picklist on the Search Filter object to include the API name of the EdInst Suitability field we created on the Product Object to the Values list. Also, click Change next to the Controlling Field of Target Object in the Picklist Options section, select EdInst_Suitability__c under the Product column and click Include Values.

Step 9. Hide the search filter that starts the Educational Institutions product search based on the quote Educational Institution formula result. In the Search Filters Related tab of the Add Dynamic Custom Action we created, click New and enter the following values:

  • For the Filter Name, enter EdInst Suitability
  • For the Target Object, select Product
  • For the Target Field, select Educational_Institution__c
  • For the Operator field, select equals
  • For the Filter Source Object, select Quote
  • For the Filter Source Field, select Educational_Institution__c
  • Check the Hidden checkbox
  • For the Display Order field, enter 40

Salesforce CPQ New Search Filter Fieldset

Now you can check whether the action behaves as expected by clicking it first in the Quote Line Editor of a Quote for an account that doesn't belong to the Education Industry and then for an account that belongs to the Education Industry.

Comments (0)

Leave a Comment