InvokeCallout2() method support SAP, SAP-PI, SAP-R/3, SFDC2SAPPI, SOAP, REST adapter types. The response could be a text of JSON, XML, List<Map<String,String>> based on given flag parameters in CallOutControl and Apex of each adapter handle setting when execute callout. InvokeCallout2() method support different mode:
1. SYNC
2. FUTURE
3. BATCH
4. AUTO
We get a real-time response in SYNC mode only.
When to use Invoke callout2()?
When the integration doesn’t follows the message type template for IStructure then we should use Invoke callout2() method. Only this method doesn’t support the specific message type template. If data proceed in queueable mode then We should use Invoke callout2().
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); |
Input Parameters:
-Integration name: Integration Name
-Interface name: Interface name
-ids: Collection of sObject id
-Mode: SYNC, FUTURE, BATCH, AUTO
CallOutControl | Flag | CalloutResponse (Attributes) | SAP | SAP-PI | SAP-R/3 | SFDC2SAPPI | SOAP | REST |
returnJSONComplete | true | String payloadJSON | no | no | no | no | yes | yes |
returnXml | true | String payloadXML | no | no | no | yes | yes | yes |
returnListRecord | true | List<Map<String,String>> records | yes | yes | yes | yes | yes | yes |
returnIMessages | true | no | no | no | no | no | no | |
actionDoIntegrate | false | Does not process interface invoke call In/Out | ||||||
actionDoMapping | true | Does nothing with this flag | ||||||
isCreateMessage | false | Does not upsert message only in mode SYNC, Otherwise message will upsert. | ||||||
isBypassDML | true | Does not upsert messages, interface, log file |
The basic requirement is To Create Integration. Then the supportive adapter. Next step is to create Outbound Interface where we have to add SOQL statement.
Execute Apex code in the developer console:-
- Navigate to the developer console.
- Click on debug.
- Open Anonymous window.
- Enter Code.
“The code and the picture is shown below”
[aux_code language=”javascript” theme=”tomorrow” title=”” extra_classes=””]skyvvasolutions.CallOutControl c=new skyvvasolutions.CallOutControl();
c.isBypassDML=false;
List<Id>myList = new List<Id>();
myList.add(‘0012v00002jxEQHAA2’);
skyvvasolutions.IServices.invokeCallout2(‘Test_41′,’Test_Outbound’,myList,’SYNC’, c);[/aux_code]