Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
1) Create an Apex Class
Steps: Click Your Name | Setup | Develop | Apex Classes and click New.
Paste the following code there.
global class asyncApex {
@future (callout=true)
public static void processAccount(Id accountId) {
sObject s = [SELECT Id, Name FROM Account WHERE Id = :accountId LIMIT 1];
// Instantiate a new http object
Http h = new Http();
// Instantiate a new HTTP request, specify the method (GET) as well as the endpoint
HttpRequest req = new HttpRequest();
// this is a test url
// Send the request, and return a response
HttpResponse res = h.send(req);
//return res.getBody();
2) Create an apex trigger that trigger the web service in the apex class
Steps: click Your Name | Setup | Customize, click the name of the object, then click Triggers and click New.
Paste the following code there.
trigger accountAsyncTrigger on Account (after insert, after update) {
for(Account a:{
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.