Skip to main content

QPlanBuilder Class


QPlanBuilder Class

This functionality is in Limited Availability. We are actively soliciting feedback from a small set of early adopters.

This article describes the global method of the QPlanBuilder class. The QPlanBuilder class is designed to build QPlan objects. The QPlanBuilder provides a global method to create new quote line items from product catalog records.

QPlanBuilder Global Methods

The QPlanBuilder class includes the following global methods.

Method Type Description
makeFromCatalog(Id quoteId, List<Id> productRatePlanIds) List<QPlan>

Makes a List of QPlans from Product Catalog based on the Product Rate Plan Ids passed into the method. This method is used to build NewProduct QPlans.

Sample Code

Make New Quote Plans from the Product Catalog

The following sample code shows how to build a list of QPlans for a Quote based on a list of Product Rate Plan Ids.

public void test(){
    String quoteId = 'quoteId_xxx';
    List<Id> productRatePlanIds = new List<Id>{'rpId_xxx1', 'rpId_xxx2', 'rpId_xxx3'};
    List<zqu.QPlan> plans = QPlanBuilder.makeFromCatalog(quoteId, productRatePlanIds);
    System.assertEquals(plans.size() == 3);
    for(zqu.QPlan plan : plans){
        // Check the type of Plan by looking at the Amendment
        System.assertEquals('NewProduct', qPlan.getAmendment.get('zqu__Type__c'),);