Happy Business Starts Here

Unintended TermsandConditions amendment record is created when an Update product amendment is made

Highlighted
Support SME

Unintended TermsandConditions amendment record is created when an Update product amendment is made

Problem:

 

Customer has a custom button where they've developed a simplified Opportunity and Quote creation for Agent Adds on Expansion Opportunities. During the automation of this process, the quote record is created successfully.

However, there are two Quote Amendment Records that are created that are associated with the Quote record.

1) UpdateProduct
2) TermsandConditions

The problem here lies in that they have  ONLY updated the Product.  They haven't done anything to the TermsandConditions for it to create this record. This is a problem because once they  sync this over to Z-Billing, two amendments are shown on the Subscription, instead of one.

 

This was reproduced inhouse running following simple code from Execute Anonymous window:

 

zqu__Quote__c quoteSObject = new zqu__Quote__c();
quoteSObject.name = 'test dray amend two';
quoteSObject.zqu__Opportunity__c = 'xxxxxxxxx';
quoteSObject.zqu__SubscriptionType__c = 'Amend Subscription';
quoteSObject.zqu__ZuoraAccountId__c = 'nnnnnnnnnnnnnn';

quoteSObject.zqu__ExistSubscriptionId__c = 'mmmmmmmmmm';
quoteSObject.zqu__Amendment_Name__c = 'test amendment';
quoteSObject.zqu__startDate__c = Date.today();  
zqu.Quote amendmentQuote = zqu.Quote.createNewInstance(quoteSObject);

// Quote and Quote Charge Details inserted to database here
amendmentQuote.buildAndSave();





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

1 REPLY 1
Support SME

Re: Unintended TermsandConditions amendment record is created when an Update product amendment is ma

Solution:

=========

 

Custom code needed to be updated  to make sure the following fields match on the new Quote vs Original Subscription, otherwise, it will automatically create a T&C amendment.

 

originalSub.autoRenew = quote.AutoRenew__c)
originalSub.renewalTerm = quote.RenewalTerm__c)
originalSub.renewalTermPeriodType = quote.RenewalTermPeriodType__c
originalSub.renewalSetting = quote.RenewalSetting__c && quote.RenewalSetting__c != null

originalSub.termType = quote.Subscription_Term_Type__c
originalSub.getTermStartDate() = quote.SubscriptionTermStartDate__c
originalSub.initialTerm = quote.InitialTerm__c && quote.InitialTerm__c != 0
originalSub.initialTermPeriodType = quote.InitialTermPeriodType__c

 






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