To invoke a callout from a trigger in Salesforce Apex, wrap the callout logic in a @future method with the callout=true annotation. The @future annotation (Apex Future Annotation) marks a method to run asynchronously, meaning the callout occurs after the triggering transaction has completed.
For example, define a global class named MyClass with a static method annotated @future(callout=true). Inside that method, include the long-running Apex callout code. The annotation takes the format: @future (callout=true), followed by a public static void method that accepts serializable parameters such as Strings or primitive types.
global class MyClass {
@future (callout=true)
Public static void myMethod(String a)
{
//long-running Apex code
}
}
Note: This approach only works if your required operation can be performed asynchronously, since @future methods do not return values to the triggering transaction.
Future methods are subject to the following Apex governor limits:
Maximum SOQL queries per future method invocation: 200
Maximum heap size per future method invocation: 12 MB
Maximum @future method calls per Apex invocation: 50
Organization-wide limit on asynchronous method invocations (including Batch Apex, Queueable Apex, Scheduled Apex, and future methods): 200 method calls per full Salesforce user license or Force.com App Subscription license, per 24-hour period. Chatter Only, Customer Portal User, and Partner Portal User licenses are not counted toward this limit.
000386018

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.