Skip to main content

Manage Existing Products on a Subscription

Zuora

Manage Existing Products on a Subscription

This article describes the Store Existing Products feature, which enables you to manage existing products on a subscription.

A batch job called storeExistingProductsJob and a new Quote Amendment type called Original are introduced for this feature. The batch job gets a single Quote Amendment record created in your quote with the type being Original, which contains the data from the existing subscription in Zuora. Therefore, you can manage the existing products on a subscription in your org without having to retrieve the data from Zuora again. You can monitor the status of this job by navigating to Setup > MonitorJobs > Apex Jobs. See more information about the Quote Amendment object in Zuora for Salesforce Object Model.

You can enable the Store Existing Products feature by navigating to Zuora Config > Advanced Quoting Configuration Settings and selecting the Store Existing Products check box.

Once the Store Existing Products feature is enabled, the storeExistingProducts batch job will be triggered when an amendment or renewal quote first gets created from the Create Amendment/Renewal Quote page. The Quote Rate Plans, Quote Rate Plan Charges, and Tiers information of your existing products on a subscription will be stored in an Original Quote Amendment object record. Next time, when the Product Selector is initiated, the ORIGINAL product information is retrieved from the record rather than from Zuora, improving the data retrieving performance.

You can check the generated Original Quote Amendment record in the Quote Amendments section on your Quote Detail page, as shown below:

Quotes_Amendment_Original.png

To display the Quote Amendments section on your Quote Detail page:

  1. Click Edit Layout on the right top of your Quote Detail page.
  2. Click Related Lists to display the related lists that you can add to the Quote Details page. 
  3. Drag Quote Amendments from the list of related lists to the page.
  4. Click the Related List Properties icon for Quote Amendments.
  5. In the Related List Properties dialog, select the columns that you want to display in quote amendments, and the order in which you want them to be displayed.
  6. Click OK.
  7. Click Save.

You can also trigger the storeExistingProductsJob job and get the Original Quote Amendment record generated via the zqu.zQuoteUtil.storeExistingProducts global method. See zQuoteUtil Global Methods for the zqu.zQuoteUtil.storeExistingProducts global method. A sample code is as below:

//Trigger the storeExistingProducts job
zqu__Quote__c quote = [SELECT Id, Name, zqu__SubscriptionType__c, zqu__ExistSubscriptionID__c FROM zqu__Quote__c WHERE Id = 'a0if40000013dLPAAY'];
zqu.zQuoteUtil.storeExistingProducts(new List<zqu__Quote__c>{quote}); 

Store Custom Fields for Existing Products

As of Quotes 9.7, custom fields can be stored on the Existing Product records generated by the storeExistingProductsJob job. See the following table for the object mapping from Zuora to Salesforce.

Zuora Object Salesforce Object
RatePlan QuoteRatePlan__c
RatePlanCharge QuoteRatePlanCharge__c
SubscriptionProductFeature QuoteProductFeature__c

 

To store a custom field:

  1. Create the custom field on the QuoteRatePlan__c, QuoteRatePlanCharge__c, or QuoteProductFeature__c object in Salesforce. The API name and Type of the custom field must be exactly the same as those of the custom field on the corresponding Zuora object (RatePlan, RatePlanCharge, or SubscriptionProductFeature).
  2. Add the custom field you created in Step #1 to the object's field set. See the following table for the object and field set mapping.
    Salesforce Object Field Set Name
    QuoteProductFeature__c CustomFeatureQueryFields
    QuoteRatePlan__c CustomRatePlanQueryFields
    QuoteRatePlanCharge__c CustomChargeQueryFields
  3. After the storeExistingProductsJob job finishes successfully, the custom field value will be stored in the containing object.

Note that the storeExistingProductsJob job will fail if you add a field that does not exist in the corresponding Zuora object to any of the field sets. You will be prompted with an error message indicating that the query into Zuora is invalid.

Store Existing Products for High Volume Quotes

Prior to 9.10, the storeExistingProductsJob Job could hit platform limits when a high volume Quote of Amendment or Renewal type was created. As of Quotes 9.10, the Store Existing Products feature is enhanced to support High Volume Quoting. When a Quote is marked as High Volume, an additional Apex job storeExistingProductsBatchable will be run to store QuoteRatePlanCharges and QuoteRatePlanChargeTiers.

To use the High Volume Quoting feature:

  1. Go to Zuora Config > Quote Configuration Settings. Select the Enable High Volume Quoting.
  2. Go to Zuora Config > Advanced Quoting Configuration Settings. Adjust the value of the Store Existing Products Batch Size. The default batch size is 200. With a bigger batch size, the performance of storing Rate Plans is generally higher. On the other hand, it is more probable to get a timeout when batch size is bigger. This step is optional.
  3. Select High Volume in Quote Details Page when creating an Amendment or Renewal Quote that should be processed in bulk. 

Once the Amendment or Renewal Quote is created, two jobs will be triggered:

  1. storeExistingProductsJob: this Queuable job inserts all QuoteRatePlans for the Quote.
  2. storeExistingProductsBatchable: this Batch Apex job stores all QuoteRatePlanCharges and QuoteRatePlanChargeTiers for those QuoteRatePlans.

You can monitor the status of these jobs by navigating to Setup > MonitorJobs > Apex Jobs.

Programmatically, you can monitor the progress of the jobs by grouping all QuoteRatePlans on the Quote by the zqu__DataStored__c field. Once the zqu__DataStored__c is true on all QuoteRatePlans, the Quote is ready to be edited. See the following sample code:

SELECT COUNT(Id), zqu__DataStored__c FROM zqu__QuoteRatePlan__c WHERE zqu__Quote__c='a0i110000072PNIAA2' GROUP BY zqu__DataStored__c

Limits

Once this High Volume Quoting feature is enabled:

  • The End of Last Invoice Period option in Create Quote will be disabled.
  • QuoteProductFeatures will not be stored.
  • When using the zQuoteUtil.storeExistingProducts global method, the input must be a List of either High Volume Quotes or Non-High Volume Quotes, but not both.
  • QuoteRatePlanCharges and QuoteChargeSummaries are NOT created under the Renewal Quote Amendment, whereas the product information is stored on the Original Quote Amendment record.