Welcome to Zuora Product Documentation

Explore our rich library of product information

ProductActionUtil class

This article describes the properties and global methods in the ProductActionUtil class.

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

Note:

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.

Quote Class Global Methods

Return Type

Method

Description

Quote Products

addQuoteProducts(List<Product> products)

Accepts a list of Product objects and is responsible for incorporating new quote products into the quote. It processes the provided list of Product objects, groups them, adds them to the quote, and returns a list of QuoteProduct objects successfully added. If no new products are provided, it returns an empty list.

Quote Products

updateQuoteProducts(List<QuoteProduct> quoteProductsToUpdate)

Takes a list of QuoteProduct objects as a parameter and is responsible for updating specific quote products. If no products are provided for an update, it returns the list of updated quote products without performing any additional updates. Otherwise, it returns a list of quote products that were successfully updated.

Quote Products

deleteQuoteProducts(List<QuoteProduct> quoteProductsToDelete)

Accepts a list of QuoteProduct objects and categorizes quote products to be deleted into two lists: those that can be deleted immediately if the QuoteProduct does not have a charge group, and if the QuoteProduct has a Charge Group, those that need to be deleted upon the save operation, which is returned through this method.

Quote

getNewInstanceByEntity(String entityId)

Accepts an Entity Id and returns a newly created Quote record instance by populating default values and associating it with the Entity.

Quote

createNewInstance(Quote__c quoteSObject)

Accepts only a 'Quote__c' record, which is used for the creation of a new 'Quote' instance. It sets up default values and record types for the Quote. Additionally, this method returns the quote record.

zChargeGroup

getAddedChargeGroups()

Returns the list of added charge groups associated with the quote, allowing external codes or classes to access and work with this information if needed.

zChargeGroup

getUpdatedChargeGroups()

Returns the list of updated charge groups associated with the quote, allowing external codes or classes to access and work with this information if needed.

zChargeGroup

getDeletedChargeGroups()

Returns the list of deleted charge groups associated with the quote, allowing external codes or classes to access and work with this information if needed.

QuoteProduct Class Global Methods

Return Type

Method

Description

zChargeGroup

addRatePlanActions(List<zChargeGroup> actionsToAdd)

Queue up rate plan actions for addition to the QuoteProduct, and they will be processed or executed later according to the logic within the class.

zChargeGroup

updateRatePlanActions(List<zChargeGroup> actionsToUpdate)

Stage rate plan actions for updating within the QuoteProduct. It doesn't perform the actual updates immediately but instead prepares a list of rate plan actions to be updated at a later stage or as part of another process. It provides a way to manage and track these updates before they are executed (basically, it prepares the list).

zChargeGroup

deleteRatePlanActions(List<zChargeGroup> actionsToDelete)

Manage the deletion of rate plan actions by filtering out and moving them from the ratePlanActions list to the ratePlanActions to be deleted list based on the provided actions to Delete.

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();