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

can we do a Callout from with in a Trigger ?

Hi Ajju, you need to spend some time looking over the training materials we have on this site.
Hi Ajay, 

Callout is a ASynchronous process where as Trigger is Dynamic / Synchrinous. 

That means it is not directly possible to do a webservice  callout from a triiger. 

But using @Future annotation we can convert the Trigger into a Asynchrinous Class and we can use a Callout method. 

See the links below for some more information , 

You can invoke callouts from triggers by encapsulating the callouts in @future methods: 

Mentioned in the idea:

A related thread, 

Callout from triggers are currently not supported.

An Apex trigger can execute a callout when the callout is invoked within a method defined as asynchronous: that is, defined with the @future keyword. The @future annotation signifies that the Apex method executes asynchronously. For more information on the @future annotation, please read the documentation.

Main Doc: Apex Web Services and Callouts

yes You can. It is same as usual  class method calling  from trigger. The only difference being the method should always be asynchronous with @future
Yes we can do callout from trigger but have to use future method. If anyother info required regarding the same let me know.
Pratik Raut 14Pratik Raut 14
Yes, you can.
Ahmed Ansari 13Ahmed Ansari 13
Yes , You can using  @future(callout=true) with callout method to call it in trigger

Ahmed Ansari