+ Start a Discussion
Mauricio OliveiraMauricio Oliveira 

How to update object after calling a http callout of a managed package?

Hi everyone,

I have a visualforce page with a button that is supposed to call an external webservice (REST API). But now I want to make an update in my object after the callout is finished. I read this article about the Continuation class but it seems that I need access to the HttpRequest object to make this work, which is not the case. I am calling a higher level function of a managed package that will make the callout.

So, is it possible to update the object after the callout and avoid getting "You have uncommitted work pending. Please commit or rollback before calling out"?

Thanks in advance.
Best Answer chosen by Mauricio Oliveira
Mauricio OliveiraMauricio Oliveira
Actually I was doing another external callout after my DML operation statement and didn't notice. Apparently just by making the "update" as the last statement of my apex method is enough to make it work. Thanks anyway.