Happy Business Starts Here

Sample Code for zqu.zQuoteUtil.setSubscriptionTermChanges

Zuora Support

Sample Code for zqu.zQuoteUtil.setSubscriptionTermChanges

Please use the below sample code to use the zqu.zQuoteUtil.setSubscriptionTermChanges Global method. 



zqu__Quote__c quote = [SELECT Id, zqu__ExistSubscriptionID__c, zqu__RenewalTerm__c FROM zqu__Quote__c WHERE Id = 'a1G0I0000025lzv'];
System.debug('Quote---: ' + quote);
Map < String, Object > termsAndConditionChanges = new Map < String, Object > ();
Decimal newRT = quote.zqu__RenewalTerm__c + 4;
quote.zqu__RenewalTerm__c = newRT;
termsAndConditionChanges.put('zqu__RenewalTerm__c', newRT);
System.debug('Changes Map: ' + termsAndConditionChanges);
Map<String,Map<String,Object>> completeMap = new Map<String,Map<String,Object>>
{quote.zqu__ExistSubscriptionID__c => termsAndConditionChanges};
System.debug('Final Map for call: ' + completeMap);

try {
// Commit Quote Changes to database
update quote;
 catch (Exception e)

{ System.debug('Call failed'); System.debug('Exception: ' + e.getMessage()); }

This will update the Quote and will create a TermsAndConditions Quote Amendment record for the quote. 


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