SK SKYVVA Documentation

5. Sending data in batch mode

We already have the method invoke Callout () which is using to send data from Salesforce to the external system (SFDC to SAP/SAP-PI) through Interface outbound. Through this new feature, we are able to return the result as JSON, XML,             List>. This feature is implemented only for SAP, SOAP and Rest adapters.

This is Calls API Syntax

CalloutResponse response=IServices.invokeCallout2(String integrationName, String interfaceName, String[] ids, String mode, CallOutControl outBoundControl) Response could be text of JSON, XML, List> based on given flag parameters in CallOutControl and Apex of each adapter handle setting when execute callout. NOTE: Getting a real-time response is only in mode SYNC. Input Parameters:

CallOutControl Flag CalloutResponse (Attributes) SAP SAP-PI SAP-R/3 SFDC2SAPPI SOAP REST

returnJSONComplete true String payloadJSON no no no no yes yes

return XML true String payloadXML no no no yes yes yes

returnListRecord true List> 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, Otherwis,e message will upsert.

Follow the use case to use batch mode in callout2: Step1: Create Adapter:

Step2: Create Integration and Outbound Interface:

[aux_code language="javascript" theme="tomorrow" title="" extra_classes=""] skyvvasolutions.CallOutControl c=new skyvvasolutions.CallOutControl(); c.returnxml=true; c.returnListRecord=true; c.iscreatemessage=true; List lId = new List(); for(Account a : [SELECT Id FROM Account]){ lId.add(a.Id); } skyvvasolutions.IServices.invokeCallout2('Shweta','Batch mode',lId, 'BATCH', c); [/aux_code]

Response type in debug: 1 XML

>XML: Internal error: Field "language" in structure PI_PERSONALDATA is empty00190000004ZlxZAAS 2 List of Map
>>List of Map:({ERP_DEBTOR_ID__c=, Id=00190000004ZlxZAAS, MESSAGE=Internal error: Field "language" in structure PI_PERSONALDATA is empty})

Open this article in the interactive viewer →