Skip to main content

Default Values Plugin


Default Values Plugin

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.

Note: If you have created your own plugins to populate default values of quotes in Zuora Quotes, you can continue to use your registered plugins in Quote Studio. See Populate Value Plugin example for a code example and the detailed steps.


Take the following steps to set the default values using Default Values Plugin of CPQ X:

  1. In your Salesforce org, click Setup.jpg and select Developer Console.
  2. In the Developer Console, navigate to File > New > Apex Class.
  3. Enter the custom plugin name in the dialog, for example, MyDefaultValuesPlugin. Then click OK.
  4. Programmatically create a plugin that implements the DefaultValuesPluginV2 interface, then navigate to File > Save to save the plugin. The following code snippet provides the sample structure of the class.
    global class MyDefaultValuesPlugin implements zqu.DefaultValuesPluginV2 {
        global void initialize(zqu__Quote__c quote) {
           //Add implementation code here...
    Note: Do not change the Initial Term value if the subscription type is Amendment Subscription or Renewal Subscription.
  5. Register the plugin name in the Default Values Plugin setting.
    1. Navigate to Zuora Config > Quote Studio Settings > Plugins.
    2. Switch the Default Values Plugin toggle to Active and enter the plugin name.
    3. Click Save.


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.


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.

Note: 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 =;
        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.