Happy Business Starts Here

How to throw validation message if there is any change made on Original Charge for Amendment Quote?

Zuora Support

How to throw validation message if there is any change made on Original Charge for Amendment Quote?

In a specific requirement, during Create Quote flow for an Amendment Quote, user trying to make sure the users Cannot Modify the fields of the Original Charge.

But cannot make these fields ReadOnly at the Rate Plan charge level as users should be able to update these fields for the newly added charge. Hence, user would like to throw a validation message if there is any change made on any of these charge fields for the Original Charge.

 

Please find below the solution for the reported scenario.





SigNowBlue.png

 


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 Support

Re: How to throw validation message if there is any change made on Original Charge for Amendment Quo

In this scenario, user can try using RusleEnginePlugin.

https://knowledgecenter.zuora.com/CA_Commerce/I_Development_Resources/C_Component_Library/B_Global_C...

In order to achieve this, you need to find out the field values in the original charge and compare those with user entered field values. the whole purpose of this plugin is to run before save of the products page and prevent changes to the original charge field values

You can run a comparison between an originalChargeGroup.zCharge with the current version of the zCharge, using the PRODUCT_RATE_PLAN_CHARGE_ZUORA_ID to pair them up.

This should work if you work with only one zChargeGroup at a time.

On the

runPriceRules(List<zqu.ZChargeGroup> zcgs,List<zqu.ZQuoteRulesEngine.ChangeLog> logs) method, you should be able to make your way down to the zCharge.PRODUCT_RATE_PLAN_CHARGE_ZUORA_ID field.

for(zqu.ZChargeGroup chargeGroup: zcgs) {
// Perform validation at this level, since all PRPCId values are unique
for(zqu.ZCharge charge: zcg.zCharges) {
System.debug(charge.PRODUCT_RATE_PLAN_CHARGE_ZUORA_ID);
}





SigNowBlue.png

 


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