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

HTTP HttpRequest fails in Triggers Callout from triggers are currently not supported.

Apex script unhandled trigger exception by user/organization: 005U0000000IWs4/00DU0000000JDvW


AssociateSection: execution of BeforeUpdate


caused by: System.CalloutException: Callout from triggers are currently not supported.


Trigger.AssociateSection: line 58, column 1


Is there a work around for adding an HTTP post inside a trigger? Apex Classes??






HTTP HttpRequest Callouts does not work out in triggers. You can call them From Apex Classes.


Small Code how to use Http request in Apex Classes



        httprequest hreq=new httprequest();

        string refresh_url=''+consumer_key+'&client_secret='+client_secret+'&refresh_token='+refresh_token;




        hreq.setHeader('Authorization:', 'OAuth '+acc_tken);


        hreq.setHeader('Content-Type', 'text/xml;charset=UTF-8');

        hreq.setHeader('Accept', 'application/xml;charset=UTF-8');


        http htp=new http();

        httpResponse res=htp.send(hreq);



Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved. 


You have to make callouts after any DML operations.


Change the trigger to be "after update", perform all of your DML, then perform the callout(s).

Sam AlexSam Alex
If we cant send call out from triggers how to perform them after update?