The callout methods are using to send data from salesforce to external system (SFDC to SAP/SAP-PI) through interface outbound. The Service only sends one record/children per request to SAP. To invoke callout from apex trigger the method invokeCallout(interfaceId, ids, ‘AUTO’) is recommended.
When to use Invoke callout()?
When the integration doesn’t follows the message type template for IStructure then we can use Invoke callout() method. this method doesn’t support the specific message type template and also doesn’t support queueable mode.
Invoke Callout() | Invoke Callout2() | Invoke Callout3() |
There are different Parameter in each callout for each version. In Invoke callout() , there is only one parameter i,e Interface ID. | In Invoke callout2(), we pass two parameter interface Name and integration name . | In Invoke callout3() also, we pass two parameter interface Name and integration name . |
Invoke callout() doesn’t support queueable mode | Invoke callout2() supports all modes. | Invoke callout3() supports all modes. |
It doesn’t support message type template. | It doesn’t support message type template. | It supports message type template. |
Callout code: IServices.invokeCallout(‘InerfaceID’,new String[]{‘Enter AccountID’},’SYNC’); |
Callout code skyvvasolutions.CallOutControl c= new skyvvasolutions.CallOutControl(); c.returnxml=true; c.returnListRecord=true; c.iscreatemessage=true; List<String> lId = new List<String>(); for(Account a : [SELECT Id FROM Account]){ lId.add(a.Id); } |
Callout Code: skyvvasolutions.CallOutControl c= new skyvvasolutions.CallOutControl(); c.returnXml=true; c.returnListRecord=true; c.isCreateMessage=true; c.actionDoIntegrate=true; String[] ids=new String[]{‘0013N00000M22FbQAJ’}; skyvvasolutions.Iservices.invokeCalloutV3 (‘Von_Integration’,’SAP_PI_PO_Rest_Out’,ids,’SYNC’, c); |