It is a new API (skyvvasolutions.IServices.invokeCalloutV3) for sending the data from salesforce to other system throughout interface outbound with specific adapter type and message-type. A message can be routed to different target interfaces that by iworkflows. Moreover,it also provides some functionalities that can be overridden by custom apex class.
Skyvva have V3 outbound processing feature to allow user to add custom apex class instead of using skyvva standard processing flow. When User use this he need to code every thing using his apex class. This is many works and big effort for him. For some business requirement he need the mapping from skyvva but need only to plug-in his logic to a certain part of our processing flow chain. With this task we allow customer to add logic to the last step e.g. Post Processing of our interface standard processing logic. Here only this place is customer code and the other places are skyvva standard processing code.
Example ofexecution callout:
- Without passing any parameter to the API
User want to send the account that are updated to external system from apex trigger
List<Id> ids=new List<Id>();
for(Account a: Trigger.new){ ids.add(a.Id);}
skyvvasolutions.IServices.invokeCalloutV3(‘SF to SAP’ , ‘Account request SAP Number’, ids, ‘AUTO’ , null);
- Passing any parameter throught the API
User wants to pass the data of account and its contacts from the screen, s/he needs to create parent-child interface(chain) to handle such as payload.
CallOutControl c=new CallOutControl();
Map<String,String>m,mCh;
//Parent-data (for Parent interface)
m=new Map<String,String>();
m.put(‘Name’,’Test’);
m.put(‘BillingCity’,’Test City1′);
m.put(‘BillingCountry’,’Test Country1′);
//child-child data (for child interface)
mCh=new Map<String,String>();
mCh.put(‘FirstName’,’test’);
mCh.put(‘LastName’,’test’);
mCh.put(‘Email’,’test@gmail.com’);
c.setPayLoad(m, new List<Map<String,String>>{mCh});
CallOutControloutBoundControl=null;
List<skyvvasolutions.CalloutResponse> results=skyvvasolutions.IServices.invokeCalloutV3(‘SF to SAP’ , ‘Account request SAP Number’, null, ‘SYNC’ , c);
How to customize outbound processing with custom apex class? #
There two ways that user can override the outbound processings
Override the steps of executions
It is an interface custom processing for an interface; the apex class can be override the following global functions.
The steps such as query, mapping, workflow and operation are executed by default and other steps will be executed base on the value setting on interface’s field <Custom Plug-in to SKYVVA Block>.
NOTE:
Due to DML does not allow to execute before invoke callout from salesforce. So the DML cannot be executed in those steps before the step operation (executeOperation), yet if interface has defined some workflows routes the message to different target outbound interfaces, the DML can’t execute in all steps because the API will execute other target interface in the next workflow.
V3OutboundStepProcessing methods | Description |
query(String soql, List<Id> ids) | Return List<SObject>that is based on query and given record ids |
beforeMapping(IServicesUtil.IMessageResultmr) | It will be executed if interface is setting<Custom Plug-in to SKYVVA Block: Before Mapping>, return skyvvasolution. IServicesUtil.IMessageResultwhich contains list message and map of source data the in the ordered index. Those objectes should be cloned to bypass the reference of <mr> |
executeMapping(IServicesUtil.IMessageResultmr, List<IMapping__c>listMapping) | Mapping processing by default, itreturns Map<String, Map<String,String>> , that is mapping result of each message that is specifiedmessage-field <External_Id2__c> as key |
beforeWorkFlow(IServicesUtil.IMessageResultmr, Map<String, Map<String,String>>mapResult) | It will be executed if interface is setting <Custom Plug-in to SKYVVA Block: Before WorkFlow>, return skyvvasolutions.IServicesUtil.IMessageResult, it should be cloned to bypass referenced change in the given of parameter <mr> |
executeWorkFlow(IWorkFlow__c wf, IServicesUtil.IMessageResultmr, Map<String,Map<String,String>>mapResult) | A target interfaces could have an apex classfor the logic to filter messages before execution of its adapter operation. skyvvasolutions.IServicesUtil.IMessageResultis a filter result for building the request payload for a specific interface. |
beforeOperation(List<V3OutboundUtils.MessageTree>msgTrees) | It will be executed if interface is setting <Custom Plug-in to SKYVVA Block: Before Operation>. It return nothing |
executeOperation(Adapter__c adapter, List<V3OutboundUtils.MessageTree>msgTrees) | Executing the apex class that has been implemented for specify adapter type such as SOAP or REST, a custom operation class that is setting on interface (Operation: Custom Apex Class). It should be returned the object skyvasolution.V3OutboundUtils.Response |
afterOperation(V3OutboundUtils.Response response) | It is execute after operation and return nothing.<Custom Plug-in to SKYVVA Block: After Processing> |
How to use V3 outbound processing with Rest adapter? #
- Create REST Adapter then link to interface request(outbound)
+ Click Test connection to confirm Adapter that we have create can connect to google drive or not.
- Create message type for REST template
Manual create message type for REST template (google drive api)Manual create message type for REST template (google drive api)
- Create custom field on object Account:
- Create interface request(outbound) and interface response (inbound) , link interface inbound to outbound :Configuration on Interface using for google
Request Interface
Link response Interface
Link rest Adapter to Request interface
Mapping
Response Interface
Mapping
- InvokeCallout3()
skyvvasolutions.CallOutControl c = new skyvvasolutions.CallOutControl();
c.returnJSONComplete=true;
c.actionDoIntegrate=true;
c.isCreateMessage=true;
String[] ids= new String[]{‘0011X00000TdIAXQA3′,’0011X00000TdIAYQA3′,’0011X00000TdIAZQA3’};
skyvvasolutions.Iservices.invokeCalloutV3(‘TEST-INTEGRATION’,’GoogleDrive_CreateFile_Request_POST_SK’,ids,’SYNC’,c);