Happy Business Starts Here

Highlighted
Support SME

How to display the error messages while doing a preview quote in a custom page

Problem:

 

We need help in capturing the error messages thrown by Avatax while doing a preview quote. We have extended zqu.QuotePreviewController to customise the preview quote page but we were unable to notify the users in case if there are any errors. Basically, we are trying to achieve the same thing as in Quote detail page.

 






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: How to display the error messages while doing a preview quote in a custom page

Solution:

 

Customer had the following custom method in their custom class :

 

public void previewQuoteBillingResult(){

// Force the quote to recalculate to get the quote metrics

try {

zqu.zQuoteUtil.ZBillingResult previewResult = zqu.QuoteRecalculateController.JR_recalculate(quote.Id);

} catch (Exception ex) {

  appendErrorMessage(ex.getMessage());

}

}

 

The reason the previewQuote error was not getting displayed because customer was trying to catch an exception instead of looking into the result directly. It was required to capture the message from previewResult and display it on the custom page

 

The problem was resolved by updating the code like below:

 

public void previewQuoteBillingResult(){
// Force the quote to recalculate to get the quote metrics
zqu.zQuoteUtil.ZBillingResult previewResult = zqu.QuoteRecalculateController.JR_recalculate(quote.Id);
if(String.isNotEmpty(previewResult.message)){
appendErrorMessage(previewResult.message);
}
}

 






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