Happy Business Starts Here


Re: TCV, MRR not populating after v7.x upgrade (sandbox)

The way I most recently implemented uses Preview Quotes


List<zqu.zQuoteUtil.zBillingResult> results = zqu.zQuoteUtil.PreviewQuotes(quoteIdList);


This call is a wrapper for zqu.zQuoteUtil.sendToZBilling with the options for preview turned on.


The preview returns the metrics and you have to manually update the quote similar to

		if (billingResult.success == false)	{
			return quote;

		quote.zqu__Previewed_MRR__c = billingResult.totalMrr;
		quote.zqu__Previewed_TCV__c = billingResult.totalTcv;

		if (billingResult.totalInfo != null){
			quote.zqu__Previewed_Discount__c = billingResult.totalInfo.discount;
			quote.zqu__Previewed_SubTotal__c = billingResult.totalInfo.subTotal;
			quote.zqu__Previewed_Tax__c = billingResult.totalInfo.tax;
			quote.zqu__Previewed_Total__c = billingResult.totalInfo.total;

The BillingResult Info is found here BillingResult It also includes charge metrics but I am not using those in this case.


There are limitations using this method - it throws an exception

zqu.QuoteToBillingHandler.ZQuoteToBillingException: Validation errors were found in the data passed to the global method:
The quote(s) (a1Z....) cannot get quote metrics from Zuora with more than 10 amendments.

 if there are more than 10 amendments on one of the quotes and it sometimes returns

Success = true, Message = Child Quote or Parent Quote or Readonly quote cannot be previewed

I have support tickets for each of these two.


Other reasons why it might not return metrics are 

Success = false, Message = The subscription being amended (id=a1Z...) by the quote is no longer the latest version.

Success = false, Message = The Quote metrics value is the latest, no need to preview.

Success = false, Message = Invoices cannot be generated in a closed Accounting Period.


I also have code that previews the metrics using the SOAP subscribe() and amend() calls - it is significantly more detailed as it requires you sending the charge details and amendment details in code and parsing invoices to tally up the numbers.  However it does work for more than 10 amendments

Maggie Longshore
Valued Scholar

Re: TCV, MRR not populating after v7.x upgrade (sandbox)

Good stuff! Thanks a bunch!