Welcome to Zuora Product Documentation

Explore our rich library of product information

Commitment default value plugin sample code

Sample code for a plugin that sets default commitment type, payment term, and schedule amounts on quotes.

The following example sets a default commitment type and payment term on the commitment, and sets a default amount on each generated commitment schedule.

global with sharing class MyCommitmentDefaultPlugin
        implements zqu.CommitmentDefaultValuesPlugin {

    global void initialize(
            zqu__Quote__c quote,
            zqu__Commitments__c commitment,
            List<zqu__CommitmentSchedule__c> schedules) {

        // Set default field values on the commitment
        if (commitment.zqu__CommitmentType__c == null) {
            commitment.zqu__CommitmentType__c = 'Revenue';
        }
        if (commitment.zqu__PaymentTerm__c == null) {
            commitment.zqu__PaymentTerm__c = 'Net 30';
        }

        // Set a default committed amount on each schedule
        for (zqu__CommitmentSchedule__c schedule : schedules) {
            if (schedule.zqu__Amount__c == null) {
                schedule.zqu__Amount__c = 1000;
            }
        }
    }
}