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
lms124lms124 

what is use of @furute annotation?

hi every one

 

public class CallWSDLMethod{
 @future(callout=true)
  public static void hi(Id d){
   Book__c b=[select name,Author_name__c from Book__c where id=:d];
 
partnerSoapSforceCom.Soap obj1=new partnerSoapSforceCom.Soap();
partnerSoapSforceCom.LoginResult x=obj1.login('naveenbathula@sfdc.com','9395311706@bnktxFhyI9yuUkFZAKr6gju5p5rd');

soapSforceComSchemasClassS2ssoapaut.s2ssoapauto obj = new soapSforceComSchemasClassS2ssoapaut.s2ssoapauto();
obj.sessionHeader=new soapSforceComSchemasClassS2ssoapaut.sessionHeader_element();
obj.sessionHeader.sessionid=x.sessionId;
obj.mm(b.name,b.author_name__c);
}
}

 

i wrote above pragram for salesforce (org1) to salesforce (org2) integration dano successfully but if  remove callout=true  data is not inserting into org2 .

 

What is actual purpose of @future annotation ?

 

what is the use of callout=true?

 

Sheikh Abrar Ul HaqSheikh Abrar Ul Haq

@Future Annotation:
Use the future annotation to identify methods that are executed asynchronously. When you specify future, the method executes when Salesforce has available resources.

@Future (callout = true)
Specify the method to make the callout to external systems. (e.g. To execute callout method via an Apex trigger)

Further details:
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_classes_annotation_future.htm