Default values plugin
Learn how to use the Default Values Plugin of CPQ X to set default values for quotes.
It is a common use case that default values of quotes need to be populated with a dependency of other opportunity settings. For example, the initial term of the quote needs to be defaulted based on the Lead Source field of an opportunity.
In this case, you need to use the Default Values Plugin of CPQ X that supplements the pre-defined default settings in the UI.
Take the following steps to set the default values using Default Values Plugin of CPQ X:
Later, when you create a new subscription quote through the Quote Studio page, you can find that the applicable default values of the quote are populated based on the implementation in the MyDefaultPlugin class.
Example
For example, if you want to set the following default values of quotes:
-
Set Quote Start Date to the first day of next month.
-
Set Subscription Term Type based on the Lead Source field: Set the term type to Evergreen for Web opportunities, and to Termed with the 6-month initial term for Phone Inquiry opportunities.
The first step is to use the following implementation code to create a plugin.
Do not change the Initial Term value if the subscription type is Amendment Subscription or Renewal Subscription.
global class MyDefaults implements zqu.DefaultValuesPluginV2 {
global void initialize(zqu__Quote__c quote) {
// Start First of Next Month
Date firstOfNextMonth = System.today().toStartOfMonth().addMonths(1);
quote.zqu__StartDate__c = firstOfNextMonth;
// Skip Terms for non-New Subscriptions
if (quote.zqu__SubscriptionType__c != 'New Subscription') return;
// Set Terms based on Opportunity Lead Source
if(quote.zqu__Opportunity__c == null) return;
Opportunity opp = [SELECT Id,LeadSource FROM Opportunity WHERE Id=:quote.zqu__Opportunity__c LIMIT 1];
if(opp.LeadSource == 'Web') {
// Web Orders are Evergreen
quote.zqu__Subscription_Term_Type__c = 'Evergreen';
} else if (opp.LeadSource == 'Phone Inquiry') {
// Phone Inquiries are 6 Months
quote.zqu__Subscription_Term_Type__c = 'Termed';
quote.zqu__InitialTerm__c = 6;
quote.zqu__RenewalTerm__c = 6;
}
}
}
After the plugin is created successfully, navigate to the Default Settings of Quote Studio, switch the Default Values Plugin toggle to Active and enter MyDefaults , then save the configuration.
Subsequently, you can create a new subscription quote from an opportunity to verify if this plugin works as expected.