function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

You have uncommitted work pending.

I have a apexclass which calls an external webservice...

with the response i  am updating and inserting in the account object...


after everything has been updated and inserted i call the same webservice again with an other operation to tell the webservice that everything has been Done !


When i call the webservice with the other operation i get the "You have uncommitted work pending..." error.



How can i call the webservice after i inserted and updated....?

(i want to call the webservice after the updates and inserts because only then i know if everything went well!)

you can't make a callout once you've started a db transaction. your best bet is probably to do the 2nd callout via an @future method.

then i get the Exception: Future method cannot be called from a future method


scenario: cronkit  triggers a custom cronkit trigger, this custom trigger calls a @future apexclass, the apexclass does a callout


and then after the callout i update and insert things in account and then i calling another @Future class


suggestions ?