Happy Business Starts Here

Valued Scholar

Cannot create quote rate plan while creating amendment quote from Zquotes quote class

Hey all,

I am trying to create an amendment quote with amendment type "UpdateProduct" but unfortunately my quote is being created with amendment type "TermsAndConditions". This is also not bringing in quote rate plans for existing products. I am trying to update quantity of existing product on a subscription with this exercise.


I am referencing code example 3 from Quote class documentation.

Any guidance is greatly appreciated !!

//Create a new Quote
zqu__Quote__c quoteSObject = new zqu__Quote__c();
quoteSObject.zqu__SubscriptionType__c = 'Amend Subscription';
quoteSObject.zqu__ZuoraAccountId__c =
   ApexPages.currentPage().getParameters().get('existingAccountId');
quoteSObject.zqu__ExistSubscriptionId__c =
   ApexPages.currentPage().getParameters().get('existingSubscriptionId');
  
zqu.Quote amendmentQuote = zqu.Quote.createNewInstance(quoteSObject);
 
// Quote and Quote Charge Details inserted to database here
amendmentQuote.buildAndSave();
 
 //Add products to the Quote
List<zqu.Product> productsToAdd = zqu.Product.loadProductsWithChildren(new List<Id>{'product1Id', 'product2Id'});
List<zqu.QuoteProduct> addedProducts = amendmentQuote.addQuoteProducts(productsToAdd);
 
// Creates/updates/deletes Quote Charge Detail records
// based on changes made to the Quote Products
amendmentQuote.save();

 

 

Thanks,
Vinar
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Valued Scholar

Re: Cannot create quote rate plan while creating amendment quote from Zquotes quote class

Thanks @doyeli and @Manojna for helping out. I was able to create quote rate plans.

 

Here is a good read about the same.

Thanks,
Vinar

View solution in original post

7 REPLIES 7
Highlighted
Zuora Support

Re: Cannot create quote rate plan while creating amendment quote from Zquotes quote class

@vinar

Thank you for the information provided. I will review this further and update you shorlty






If you found my answer helpful, please give me a kudo ↑
Help others find answers faster by accepting my post as a solution √

Highlighted
Valued Scholar

Re: Cannot create quote rate plan while creating amendment quote from Zquotes quote class

@Manojna Thanks for looking into this.  Any direction I can move forward in ?

 

CC @doyeli If you already know anything about this?

Thanks,
Vinar
Highlighted
Zuora Alumni

Re: Cannot create quote rate plan while creating amendment quote from Zquotes quote class

hi @vinar hope you are doing fine Smiley Happy

We are testing the same code  on our end and will post an update with our finidng

 

Thank you
Doyeli






If you found my answer helpful, please give me a kudo ↑
Help others find answers faster by accepting my post as a solution √

Highlighted
Valued Scholar

Re: Cannot create quote rate plan while creating amendment quote from Zquotes quote class

@doyeli I am doing good. Thanks for asking and I hope new year is treating you well.

Appreciate your feedback and look forward for findings.

Thanks,
Vinar
Highlighted
Zuora Alumni

Re: Cannot create quote rate plan while creating amendment quote from Zquotes quote class

Hi @vinar, I have just tested the following code which, is new Product Amendment, 

 

zqu__Quote__c quoteSObject = new zqu__Quote__c();
quoteSObject.zqu__SubscriptionType__c = 'Amend Subscription';
quoteSObject.zqu__ZuoraAccountId__c = '2c92c0f860c0fc600160d7bf99207de2';
quoteSObject.zqu__ExistSubscriptionId__c = '2c92c0f860c0fc600160d7bf99497de7';
quoteSObject.zqu__StartDate__c = Date.today();

  
zqu.Quote amendmentQuote = zqu.Quote.createNewInstance(quoteSObject);
 
// Quote and Quote Charge Details inserted to database here
amendmentQuote.buildAndSave();
 
 //Add products to the Quote
List<zqu.Product> productsToAdd = zqu.Product.loadProductsWithChildren(new List<Id>{'01tf40000008HNg'});
List<zqu.QuoteProduct> addedProducts = amendmentQuote.addQuoteProducts(productsToAdd);
 
// Creates/updates/deletes Quote Charge Detail records
// based on changes made to the Quote Products
amendmentQuote.save();

And it creates two Quote Amendment Records-- one TermsAndConditions and another NewProduct.

How are you testing the update product Amendment?

Can you please test the above code by just replacing the zqu__ZuoraAccountId__c, zqu__ExistSubscriptionId__c and the product id passed in loadProductsWithChildren and let me know what you find out

 

Thank you
Doyeli






If you found my answer helpful, please give me a kudo ↑
Help others find answers faster by accepting my post as a solution √

Highlighted
Zuora Alumni

Re: Cannot create quote rate plan while creating amendment quote from Zquotes quote class

Update-- Just to get a closure on  this thread, @vinar was not trying to use NewProduct Amendment (addQuoteProducts) . 

His use case was to use UpdateProduct Amendment.

We worked together in a seperate thread and had that sorted out.

 

Thank you

Doyeli






If you found my answer helpful, please give me a kudo ↑
Help others find answers faster by accepting my post as a solution √

Highlighted
Valued Scholar

Re: Cannot create quote rate plan while creating amendment quote from Zquotes quote class

Thanks @doyeli and @Manojna for helping out. I was able to create quote rate plans.

 

Here is a good read about the same.

Thanks,
Vinar

View solution in original post