Happy Business Starts Here

IsperiodEditable field when called through charge groups does not mimic the UI functionality

Highlighted
Zuora Alumni

IsperiodEditable field when called through charge groups does not mimic the UI functionality

 Problem

 

 

If we call the isPeriodEditable field using the chargeGroups it does not mimic the UI functionality. 

For amendment quote with original charges, the field is un-editable in the UI although zqu.zCharge.isPeriodEditable returns a 'true' value.

 

You can embedd the below code in you Quote Rules engine plugin to retrieve the value : 

 

 for(zqu.zChargeGroup chargeGroup: zcgs){
            //System.debug('original group id '+ chargeGroup.originalChargeGroup.groupID);
            //System.debug('current group id '+ chargeGroup.groupID);
            //for(zqu.zCharge originalCharge: chargeGroup.originalChargeGroup.zCharges){
            ////    originalChargePeriodMap.put(charge.ID, charge.PERIOD);
            //    System.debug('original charge period '+originalCharge.Id + originalCharge.PERIOD+' '+originalCharge.chargeObject.get('isUpdated__c'));
            //    System.debug('original PRPC '+originalCharge.PRODUCT_RATE_PLAN_CHARGE_ZUORA_ID);
            //}
            for(zqu.zCharge currentCharge: chargeGroup.zCharges){
                //String originalPeriod = originalChargePeriodMap.get(charge.ID);
                //System.debug('retrieved original charge period '+originalPeriod);
                //System.debug('current charge period '+currentCharge.Id + currentCharge.PERIOD+' '+currentCharge.chargeObject.get('isUpdated__c'));
                System.debug('current charge PRPC '+ currentCharge.PRODUCT_RATE_PLAN_CHARGE_ZUORA_ID);
                System.debug('current charge isPeriodEditable '+ currentCharge.isPeriodEditable);
            }
        }

 

 

Or you can call the class directly from the Dev Console using the below code : 

 

 

String quoteId = 'PUT QUOTE ID HERE';
List<zqu.zChargeGroup> chargeGroups = zqu.zQuoteUtil.getChargeGroups(quoteId);

for(zqu.zChargeGroup chargeGroup: chargeGroups){
    for(zqu.zCharge charge: chargeGroup.zCharges){
        System.debug('name'+charge.NAME+' '+charge.isPeriodEditable);
    }
}

 



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
Zuora Alumni

Re: IsperiodEditable field when called through charge groups does not mimic the UI functionality

Solution :

 

At the moment, IsEditable fields are derived only by Charge values, not by Charge Group values. Further validation is done in the UI. 

 

As a workaround, please consider the Charge Group type in your custom logic.
Period is editable for group types, TYPE_PRODUCT_NEW, TYPE_AMENDMENT_NEWPRODUCT, TYPE_RENEWAL_NEWPRODUCT, TYPE_SUBSCRIPTION_ADDED. 



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