Welcome to Zuora Product Documentation

Explore our rich library of product information

Default Subscription Bill to Contact and Subscription Payment Term with Default Values Plugin v2

This reference explains how to use the Default Values Plugin V2 in Quote Studio to set default values for Subscription Payment Term and Subscription Bill To Contact fields.

You can default the values of Subscription Payment Term and Subscription Bill To Contact fields using the Default Values Plugin V2 in Quote Studio.

See the following sample code as an example:

global class DefaultValuePlugin implements zqu.DefaultValuesPluginV2 {
    global void initialize(zqu__Quote__c quote) {        
    
    quote.zqu__Subscription_Payment_Term__c = 'Net 30';        
    
    //Search Contacts based on Zuora Account Id or based on Invoice Owner Id
        string zuoraAccountId = String.IsNotEmpty(quote.zqu__InvoiceOwnerId__c) ? quote.zqu__InvoiceOwnerId__c : quote.zqu__ZuoraAccountID__c;        
        
        if(string.IsNotEmpty(zuoraAccountId)){
            //Search Zuora Contact associated with Billing account or invoice owner using zuora 360;
            List<Zuora__ZContact__c> contacts =[Select Id, Zuora__External_Id__c,Name,Zuora__FirstName__c,Zuora__LastName__c from Zuora__ZContact__c where Zuora__CustomerAccount__r.Zuora__Zuora_Id__c= :zuoraAccountId];
            quote.Subscription_Bill_To_Contact_ZuoraId__c=contacts[0].Zuora__External_Id__c;
            quote.Subscription_Bill_To_Contact_Name__c=contacts[0].Zuora__FirstName__c+' '+contacts[0].Zuora__LastName__c;
        }        
        
        //Search Contacts based on Zuora Account Id or based on Subscription Owner Id
        string soldToAccountId = String.IsNotEmpty(quote.Subscription_Owner_ZuoraId__c) ? quote.Subscription_Owner_ZuoraId__c : quote.zqu__ZuoraAccountID__c;
        
        if(string.IsNotEmpty(soldToAccountId)){
             List<Zuora__ZContact__c> contacts =[Select Id, Zuora__External_Id__c,Name,Zuora__FirstName__c,Zuora__LastName__c from Zuora__ZContact__c where Zuora__CustomerAccount__r.Zuora__Zuora_Id__c= :soldToAccountId];
             quote.Subscription_Sold_To_Contact_ZuoraId__c=contacts[0].Zuora__External_Id__c;
             quote.Subscription_Sold_To_Contact_Name__c=contacts[0].Zuora__FirstName__c+' '+contacts[0].Zuora__LastName__c;        
             
             }
    }
}
Note: Like other quote fields, you can programmatically set flexible billing attributes and use sendToZBilling to send them at the subscription level in billing. To send flexible billing attributes programmatically, you need to enable the toggle Enable Flexible Billing in Quote Studio in Zuora Config > Quote Studio Settings > Admin Config.