SK SKYVVA Documentation

1. What is the different posting behavior for the inbound interface?

Learning Objective: After completing this unit, you’ll be able to:

Introduction

“Inbound Interface” when data is sent from SAP to Salesforce. So, the reference point is set to Salesforce.

Prerequisite for creating an inbound interface

Step 1. Creating an inbound interface(Salesforce) Login to the Salesforce org and then select Skyvva Integration Cloud. Go to Integration Tab and create New Integration under that go to the interfaces tab and then create New interface as shown below. Now we have to fill the following fields:

Then click on button “Save” to save your interface. Now we have to specify some required fields and other optional fields for defining the inbound interface. Following all fields related to creating an inbound interface for connecting to Salesforce are described. Note that there are also fields in the screen which is not needed for the SAP-PI coupling but needed for other couplings e.g. the SAP direct coupling. Following are the posting behaviour for the inbound interface –

An asynchronous process is a process or function that executes a task "in the background" without the user having to wait for the task to finish. Asynchronous Apex is used for callouts to external systems, operations that require higher limits, and code that needs to run at a certain time. Future Apex

  Future Apex is used to run processes in a separate thread, at a later time when system resources become available. When using synchronous processing, all method calls are made from the same thread that is executing the Apex code, and no additional processing can occur until the process is complete. Future methods can be used for any operations asynchronously in its own thread. This provides the benefits of not blocking the user from performing other operations and providing higher governor and execution limits for the process. Future methods are typically used for:

Future methods must be static methods, and can only return a void type. The specified parameters must be primitive data types, arrays of primitive data types, or collections of primitive data types. [aux_code language="javascript" theme="tomorrow" title="" extra_classes=""] global class SomeClass { @future public static void someFutureMethod(List recordIds) { List accounts = [Select Id, Name from Account Where Id IN :recordIds]; // process account records to do awesome stuff } }[/aux_code]

To make a Web service callout to an external service or API, you create an Apex class with a future method that is marked with (callout=true). The class below has methods for making the callout both synchronously and asynchronously where callouts are not permitted. [aux_code language="javascript" theme="tomorrow" title="" extra_classes=""] public class SMSUtils { // Call async from triggers, etc, where callouts are not permitted. @future(callout=true) public static void sendSMSAsync(String fromNbr, String toNbr, String m) { String results = sendSMS(fromNbr, toNbr, m); System.debug(results); } // Call from controllers, etc, for immediate processing public static String sendSMS(String fromNbr, String toNbr, String m) { // Calling 'send' will result in a callout String results = SmsMessage.send(fromNbr, toNbr, m); insert new SMS_Log__c(to__c=toNbr, from__c=fromNbr, msg__c=results); return results; } }[/aux_code]

To test future methods, enclose your test code between the startTest and stopTest test methods. The system collects all asynchronous calls made after the startTest. WhenstopTest is executed, all these collected asynchronous processes are then run synchronously. You can then assert that the asynchronous call operated properly.

Batch Apex

Batch Apex is used to run large jobs for example, data cleansing or archiving. Using Batch Apex, you can process records asynchronously in batches. Each time a batch class is invoked, the job is placed on the Apex job queue and is executed as a discrete transaction. Batch Apex has two awesome advantages:

For writing batch class you need to implement the Database.Batchable interface and include the following three methods: Start, execute and finish. To ensure fast execution of batch jobs, minimize Web service callout times and tune queries used in your batch Apex code. The longer the batch job executes, the more likely other queued jobs are delayed when many jobs are in the queue. Best practices include:

Queueable Apex - Similar to future methods, but provide additional job chaining and allow more complex data types to be used. It gives you a class structure that the platform serializes for you, a simplified interface without start and finish methods and even allows you to utilize more than just primitive arguments! It is called by a simple System.enqueueJob() method, which returns a job ID that you can monitor.

Queueable Apex allows you to submit jobs for asynchronous processing similar to future methods with the following additional benefits:

Queueable Syntax

To use Queueable Apex, simply implement the Queueable interface. public class SomeClass implements Queueable {     public void execute(QueueableContext context) {        // awesome code here    }}

One of the best features of Queueable Apex is job chaining.

In Queueable Apex following needs to be taken care –

Open this article in the interactive viewer →