Happy Business Starts Here

Error: "The callout was unsuccessful after 4 attempts: You have uncommitted work pending"

Support SME

Error: "The callout was unsuccessful after 4 attempts: You have uncommitted work pending"

Problem:

 

Error  "The callout was unsuccessful after 4 attempts: You have uncommitted work pending" was thrown when the following code was getting executed from custom Apex Class

 

zqu.zQuoteUtil.ZBillingResult previewResult = zqu.QuoteRecalculateController.JR_recalculate('<QuoteID>');

 

 






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: Error: "The callout was unsuccessful after 4 attempts: You have uncommitted work pending&qu

Solution:

 

This salesforce error is thrown when making a DML statement (create, update, delete, etc) before a callout (preview call to Zuora).

In this particular case, it was found the custom code had

 

Database.update(quoteList.values());

 

before the preview call

 

zqu.zQuoteUtil.ZBillingResult previewResult= zqu.QuoteRecalculateController.JR_recalculate(op.id);

 

After commenting out the update call and running it separately, could help resolve this error.

 






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