Skip to main content

ProductActionUtil Class

Zuora

ProductActionUtil Class

The ProductActionUtil class contains the methods that can be used to create future dated Update/Delete product actions.

To create and manage future dated amendments, the following Advanced Quoting Configuration Setting must be selected in the Zuora Config tab:

  • Enable Orders
    We are actively soliciting feedback from a small set of early adopters for the Orders feature. If you wish to have access to the feature, submit a request at Zuora Global Support.

Return Type

Method

Description

zChargeGroup createRatePlanRemoval
(zqu.zChargeGroup ratePlanToRemove,
Date removalDate)

Returns the original charge group that will be removed at a future date.

Currently, this method only accepts newly added charge groups.

zChargeGroup createRatePlanUpdate
(zqu.zChargeGroup ratePlanToUpdate,
Date updateDate)

Returns the original charge group that will be updated at a future date.

Currently, this method only accepts newly added charge groups.

Code Sample

The following code sample adds a future dated amendment to a quote via the createRatePlanUpdate method.

zqu.Quote currentQuote = zqu.Quote.getInstance('<quoteId>');

//Add a product to the quote
zqu.Product productToAdd = zqu.Product.loadProduct('<productId>');
currentQuote.addQuoteProducts(new List<zqu.Product>{productToAdd});

//Add a future update to the newly added product
zqu.ProductActionUtil actionUtil = new zqu.ProductActionUtil(); 
for (zqu.QuoteProduct qp : currentQuote.getAddedQuoteProducts()) {
    List<zqu.zChargeGroup> futureUpdates = new List<zqu.zChargeGroup>();
    futureUpdates.add(actionUtil.createRatePlanUpdate(qp.chargeGroup, Date.today().addMonths(6)));
    qp.addRatePlanActions(futureUpdates);
}

//Save both the newly added product and the future update
currentQuote.save();