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...


ERROR: You have uncommitted work pending. Please commit or rollback before calling out.

I have read many posts regarding this issue but my sistuation is not like them!  This is what I have and I am hoping that there is some kind of work-around; otherwise this entire 3 month effort is crapped!
  1. I have  trigger on the user object
  2. It calls a class with the @FUTURE
  3. It performs a REST callout to ALL our associated sandboxes and deactives the user that was deactivated from the client trigger side (prod), #1 above.
  4. On the service side (sandox(s) I deactivate the user(s) and call a Queueable routine to post a log entry on the sandbox(s)  because otherwise, I get the MIX DML error (that was the work-around for that issue if I don't use Queueable.
  5. The service side sends a response back to the client (caller) with the details of what was written to the log on the sandbox(s).
  6. Using the Queueable feature on the client side I attempt to write to its log table but I get the error message in the subject of this post!
I am now having no way to log activity that the client app successfully deactivated a user in sandbox(s) or failed!!!!

Does anyone have a work-around to such a problem?   Appreciate your support.
I recommend using Platform events for line no 6.
Magulan Duraipandian
Sorry that I did not respond back after fixing the issue.  The problem was that I was calling the multiple times instead outside the FOR LOOP!  101 no no and I did it! :)