Skip to main content

Use Case: Populate Default Dates on Cancellation Quote

Zuora

Use Case: Populate Default Dates on Cancellation Quote

This article describe the process of extending the Populate Value Plugin on the Property Component to pre-populate default date values in the Cancellation Quote flow.

The high level steps are:

  1. Extend the Populate Value Plugin
  2. Register the extended plugin

Extend the Populate Value Plugin for Default Cancellation Dates

Create a new global class in Salesforce using the following code. You must check that the record does not already exist:

global class Z_PopulateDefaultFieldsForCancelQuote extends 
    zqu.CancellationPropertyController.PopulateDefaultFieldValuePlugin{
    global override void populateDefaultFieldValue(
        SObject record, zqu.PropertyComponentController.ParentController pcc){
        
        if(record.Id == null) {
            //Populate default values in the quote header
            if(!Test.isRunningTest()) super.populateDefaultFieldValue(record, pcc); 
        
            record.put('zqu__CancellationEffectiveDate__c', 'Enter a Date');
            record.put('zqu__CancellationDate__c', Date.newInstance(2015, 10, 31));
            record.put('zqu__StartDate__c', Date.newInstance(2015, 10, 30));
            record.put('zqu__ValidUntil__c', Date.newInstance(2015, 10, 30));
        }
    }
}

Register the Extended Plugin

To register the new plugin for default cancellation dates:

  1. Navigate to Zuora Config > Component Registration.
  2. Click Edit for the CancelQuote component.
  3. In the Component Plugins section, for the Populate Value Plugin, type the plugin class in the Class Name field: Z_PopulateDefaultFieldsForCancelQuote
  4. Click Update.