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
AlaaAlaa 

http callouts in apex triggers

Hi Am trying to do soem HTTp callouts from an apex triger but when itest it fires I get the error:

contact your administrator Callout from triggers are currently not supported

 

whats this? any idea?

bob_buzzardbob_buzzard

Its exactly what it says I'm afraid - you can't make HTTP callouts from a trigger as you would be holding up the transaction for potientially a long period of time.

 

Typically you'd call an @future method to make the callout, as this would be called asynchronously after the transaction has completed.

AlaaAlaa

thanks.. am new to apex so do you have any example how can I use that @future method?

bob_buzzardbob_buzzard

There's more information in the Apex Developer's Guide at:

 

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_classes_annotation_future.htm?SearchType=Stem&Highlight=future|Future

 

but basically, you just call it as you would any other method.  The @future decoration on the method means that it gets "queued" for later execution.