SK SKYVVA Documentation

68.1 How to implement custom inbound processing with apex class by old way?

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

Introduction

We can implement custom inbound processing with apex by two ways.

what is Custom Processing Apex Class with old way?

We always response to give back the message type structure which contain the Salesforce Id and SKYVVA message Id. Customer need to write the complete code for all processing steps

Basic Processing Steps:

Message   ->  Workflow   ->   Mapping   ->  Operation

Advantage

We can the fields as we have structured data.

Disadvantage

Customer need to write the complete code for all processing all steps.

How to implement custom inbound processing with apex class:

To extend some functions of integrate inbound processing extends skyvvasolutions.IProcessCustomAbs and implements skyvvasolutions.GisOdbgIntegration.IProcess Methods are order process integration of custom processing and could be overridden if required

follow the given steps to use apex class: Step1: Create apex class

Warning: “Custom Processing Class”: provide full name of your custom processing class (including namespace if any). Format: [namespace.]classname eg: namespaceX.ClassX (if there is namespace in the salesforce instance) or ClassX (if no namespace)

The bellow is example of custom processing inbound and some methods should be overridden:

Example1:

global with sharing class SKYVVA_CustomIntegration
extends skyvvasolutions.IProcessCustomAbs
implements skyvvasolutions.GisOdbgIntegration.IProcess
{
private List<Contact> lc=new List<Contact>();
global override void doMap(skyvvasolutions.IServicesUtil.IMessageResult iResult){
//Assign value of param to its property inherited from the parent
this.iResult=iResult;
//Map data in iResult to your salesforce sObject
for(integer i=0;i<iResult.listMessage.size();i++){
//Data from SAP
Map<String,String> mapRecord =iResult.listMapRecord.get(i);
System.debug('mapRecord :: ' +mapRecord);
//
Contact c=new Contact();
c.LastName = mapRecord.get('lastname');
lc.add(c);
}
}
global override List<skyvvasolutions.IServicesUtil.UpsertResult2> upsert2(){
//upsert records
Database.UpsertResult[] results=Database.upsert(lc,false);
for(Integer i=0;i<results.size();i++){
Database.UpsertResult rs=results[i];
iResult.listMessage[i].skyvvasolutions__Status__c = 'Pending';
iResult.listMessage[i].skyvvasolutions__Modification_Date__c = System.now();
if(rs.isSuccess()){
iResult.listMessage[i].skyvvasolutions__Status__c = 'Completed';
//iResult.listMessage[i].skyvvasolutions__Related_To__c = rs[i].getId();
//Recrod is create
if(rs.isCreated()) {
iResult.listMessage[i].skyvvasolutions__Comment__c = 'Creation Record...';
}
else {
iResult.listMessage[i].skyvvasolutions__Comment__c ='Modification Record...';
}
}
else{
iResult.listMessage[i].skyvvasolutions__Status__c = 'Failed';
String errDsc='';
for( Database.Error err:rs.getErrors()){
errDsc+=err.getMessage()+' ';
}
System.debug('errDsc :: ' +errDsc);
iResult.listMessage[i].skyvvasolutions__Comment__c =errDsc;
}
}//end for
update iResult.listMessage;
return null;
}
}

Step 2: Create Integration

Step3 : Create Interface

Note: “Custom Processing” checkbox: indicates if the interface uses the custom-processing implementation

Step4 : Do mapping.

Step5: upload data manually

Step7: Check result on message board

You can not see related to link here to check detail as this interface is used custom processing. Step8 ; Check uploaded record and its details on dev console.

Open this article in the interactive viewer →