SK SKYVVA Documentation

How to use the API InvokecalloutV3() using mode based on the Interface Setting?

Introduction:

You know already that you can use invokeCalloutV3() of the outbound interface execution in the developer console, so you will set the mode parameter on the invokeCalloutV3() script. Now we have provided a new option to set the mode based on the interface setting.

How many mode parameters are set on the interface setting?

There are four modes to set on the interface setting as follows below:

Pre-Requisite:-

The Configuring of Invoke callout using mode set on the interface setting:

1: Invoke callout using Auto Switch Mode
The Script Code is shown below:

String[] ids = new String[]{}; for(Account a: [select id from account]) ids.add(a.Id); IServices.invokeCalloutV3('Integration_Name','Interface_Name',ids, new CallOutControl());

Example:

After you have executed the Apex Code, The auto mode will do three types of jobs based on your records and setting the package. It will check all records to the processing Job Type with Future, Queueable, and Batch Apex. For example, we call out 135 records and a record per job (not a set the transfer package size). Therefore Future and Queueable will do 50 jobs for each, and the remaining will do Batch Apex.

2: Invoke callout using Batch Mode
The Script Code is shown below:

String[] ids = new String[]{}; for(Account a: [select id from account]) ids.add(a.Id); IServices.invokeCalloutV3('Integration_Name','Interface_Name',ids, new CallOutControl());

Example:

3: Invoke callout using Asynchronous Mode
The Script Code is shown below:

String[] ids = new String[]{}; for(Account a: [select id from account]) ids.add(a.Id); IServices.invokeCalloutV3('Integration_Name','Interface_Name',ids, new CallOutControl());

Example:

[su_box title="Note" box_color="#2a8af0" title_color="#000000"]If the Transfer Package Size is blank means a record per callout. We are callout without a set Package Size, so the processing will callout a record per job. Queueable has 50 jobs limited. If your callout is more than the job limit, the message will be new status.[/su_box]

4: Invoke callout using Synchronous Mode
The Script Code is shown below:

String[] ids = new String[]{}; for(Account a: [select id from account]) ids.add(a.Id); IServices.invokeCalloutV3('Integration_Name','Interface_Name',ids, new CallOutControl());

Example:

Result: After you executed, it will call out all recode from an account and create a messaging API that has a business message for all records.

[su_box title="Note" box_color="#2a8af0" title_color="#000000"]If you use mode 'SYNC' means processing in real-time, it doesn’t show processing in the Apex Jobs.[/su_box]

Open this article in the interactive viewer →