Showing posts with label CPQ. Show all posts
Showing posts with label CPQ. Show all posts

Wednesday, 9 September 2020

Dynamically displays quote fields on the quote line editor based on the type of user or quote or profile

 

Issue :

  1. Previously in Quote Line Editor, we can't control the fields of the Quote. Fields remain the same for all the users and all the profiles. What if you want to have different fields for Partner and Internal Users

Solution :

  1. In the Winter '21release, CPQ has introduced a special field called "HeaderFieldSetName". You can create a field on the quote object to dynamically display specific quote field in the quote line editor. You can choose to control the quote fieldset that is displayed by using a formula field or you can allow users to make their own selection by using a picklist field.
  2. Please note this field needs to be created in the org, it doesn't come from the CPQ package by default.

Step 1 :

  1. Create the fieldsets on the Quote say for example "Partner" and "InternalUser" & add fields to the fieldsets.

Step 2 :

  1.  Navigate to the Quote Object.
  2.  Create a New Picklist Field or Formula field on the Quote object.
  3.  Set Field Name to HeaderFieldSetName.
  4.  Add the picklist values as(fieldset name created in Step 1)
    1. Partner
    2. InternalUser

Step 3 :

  1. Go to the Quote object 
  2. Edit the Line Editor Field Set and include the new field("HeaderFieldSetName")
  3.  Include the HeaderFieldSetName field on all fieldsets which are created in step 1
  4.  Click Quick Save

Step 4 :

  1. Go to any Quote and open the Quote Line Editor.
  2. Change the HeaderFieldSetName field on the Quote and do Quick Save






Prerequisite :
  1. You need to install, Winter '21 i.e 228 or above. Please note this is a prerelease feature of CPQ.


Wednesday, 11 March 2020

Salesforce CPQ : Order Management Plugin to populate Order's Start Date


Salesforce CPQ provides two options to set the Order Start Date :

  1. Quote Start Date
  2. Today's Date
What if you want to populate the Start Date of the Order to a specific date from Quote, admin or developer will 
  1. Create a Process Builder to populate from Quote
  2. Before Trigger on Order to populate the Start Date
The disadvantages of the above approach are an extra update on the Order and its custom build. This approach is likely to conflict with CPQ automation and validation. By default, CPQ will set the Order Start Date according to the package setting. When Order Start Date is set, managed Apex Triggers set Order Product Start Dates and End Dates, preserving the overall term length.

What are the options available out of the box from Salesforce CPQ?


Order Management Plugin : 
  1. Is used to set the Start Date of the Order, Salesforce CPQ automatically calls the plugin code to populate the Start Date of the Order.
  2. When the Start Date of the Order is set, Order Lines Start Date and End Date is adjusted accordingly.
  3. Order Management Plugin is just used to populated the Start Date of Order but not any other fields on Order
  4. The advantage of the plugin is you can also check any business logic in the apex class. Based on the Quote type you can set the Start Date. Say for example amendment Quote Start Date will be always Order Start Date this will ensure Subscription End Date doesn't cross the End Date of Contract.
Setup :
  1. Create a field on Quote object called Order_Start_Date__c this can be a formula date field or date field.
  2. Create a new apex class that implements SBQQ.OrderManagementPlugin
  3. The name of the Apex class for the Order Management Plugin(i.e CPQ_OrderPlugin) goes in the field Order Management Plugin in the Plugins tab of the CPQ Package Settings. 
  4. Go to the Order tab in the CPQ package settings and set Default Order Start Date to "-- None --". If any other value is populated here, it overrides the plugin.



Code : 
  1. You can find the plugin code in GitHub code: https://github.com/laxmanrao564sf/OrderPluginSalesforceCPQ
Conclusion :
  1. First preference is always to use out of the box configuration feature from CPQ
  2. Second preference is to check if there are any APIs/Plugins provided by CPQ
  3. Go for a custom build.