Skip to main content

QPlanBuilder Class


QPlanBuilder Class

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.

Security Considerations

  • Users must have the Object Read access to the following objects and Sharing access to the relevant records when triggering an action to set up new products through QPlanBuilder:
    • ZProduct
    • ProductRatePlanCharge
    • ProductRatePlanChargeTier
    • UnitOfMeasure
  • Users do not need the Read access to the ProductRatePlan object, as Sharing permission for Master-Child relationships is controlled by the Master object, ZProduct.
  • Users must have the Sharing access to a Quote in order to use QPlanBuilder to stage products to be added to the Quote. Otherwise, an exception is thrown prompting to check for access to the quote.

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 = zqu.QPlanBuilder.makeFromCatalog(quoteId, productRatePlanIds);
        System.assert(plans.size() == 3);
        for(zqu.QPlan plan : plans){
            // Check the type of Plan by looking at the Amendment
            System.assertEquals('NewProduct', plan.getAmendment().get('zqu__Type__c'));