Programmatically Update effective price

I have a requirement to clone a Zuora Quote in SalesForce to a new opportunity. I have written apex that creates the opp and a new quote using the details from the old and then creates a copy of the products and prunes down the rate plans to the ones that were used. The last thing I need to do is update the effective price(s) to match. What is the reccomended way to programatically update the effective price? I am aware it appears on a number of child objects (Quote Charge, Quote Charge Summary, Quote Rate Plan Charge), but couldnt see any convenience methods mentioned in the documentation?

Zuora Staff

Re: Programmatically Update effective price



For some context, what kind of Quotes are you cloning? Can you provide some information on the reason for the customization?


If you are cloning a New Subscription Quote, you should be able to use the "cloneQuote(...)" method described in the Knowledge Center for our Quote global class:


Note that the above method allows you to automatically clone Products in addition to the Quote (for New Subscription only).


You should be able to use other methods in the same "Quote" global class above to handle adding/removing/updating products on the Quote.


Note if you are cloning Quotes that are not New Subscription, you will need to update various IDs to tie the Quote to the proper Zuora objects.

Re: Programmatically Update effective price

Hi Mikey, thanks for your reply.


Yes they are new subscription quotes. We are trying to automate their creation on the SalesForce side for our renewal process taking details from the previous quote (we appreciate this may differ to the expected/intended process).


Per my description the quote is being cloned to a new opportunity. So I don't believe the cloneQuote() method helps as it has no option to specify a target opportunity nor are there methods provided to move quotes between opps. Please correct me if I am wrong on this.


I see there is a set method on the global quote class, however effective price is at a product/rate plan level. I have checked documentation on those related objects but not spotting any methods that look helpful. Please can you advise which method will allow me to amend the effective price?



Savvy Scholar

Re: Programmatically Update effective price

You need to use zQuoteUtil Class to update zCharges.


If you are in the CPQ X LA then you use QCharge puts.


As a warning, in the past we've found that changing effective price is limited by discount precision so make sure you test that what the recalculation is giving you is indeed what you expect it to be.

View solution in original post

Re: Programmatically Update effective price

Thanks, I was able to get to Charge from the Charge Group using the util methods.