+ Start a Discussion
Ron WildRon Wild 

How do I commit a new record before making a Callout Request?

I need to create a new instance of a custom object prior to making an outbound HTTP Service Request.
 
If I attempt to make the Callout without committing database changes, I get an error.  However, I haven't seen anything in the documentation describing how to make the commit.
 
Is there Database method (ala Database.setSavepoint())?
 
Thanks,
 
steve buikhuizesteve buikhuize

Hi Ron, I need the answer to this question as well. Did you find a solution?

Steve


Web: http://www.astitch.net

Ron WildRon Wild
Apparently there is no 'commit' instruction, and it's not possible to do this right now.   I worked around the limitation by creating my object from inside an s-control before calling the apex code that has the http service request.  Not as clean, but it works.


jnovak16jnovak16

Bump. I'm also looking for a solution to this problem.

 

From the documentation I've read [1], e-mails are only sent after a commit. I'd like to send an Outbound Message only after a commit.

 

Alternatively, my application could poll SF until it is sure that the commit has occurred (using a last-modification timestamp?).

 

 

[1] http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_triggers_order_of_execution.htm, see "post-commit logic"