SKYVVA provide completely powerful processing way with new Version3 and allow for significant flexibility. New plug-in custom logic is normally refers to the processing which will give the ability for the solution to adapt to possible changes in your requirements. If user doesn’t want to use our existing class and want to create his own class then he can add custom block. User can extend our existing class.
The picture shows the different location where the user can add their own logic. The green flow represents the standard processing flow without any custom enhancement.
- The process is started normally by a custom apex which invokes the method ‘invokeCallout2()’. The method invokeCallout2() initiate the outbound processing flow with the four steps shown with the green block and flow.
- The second step is the mapping block. Mapping processing by default, mapping result of each message that is specified message-field <External_Id2__c> as key.
- The third step is the new step ‘Workflow’. The new steps in the processing flow where we add the step/block ‘Workflow’ to do the receiver routing before we send the data.
- The fourth step is the final step in the processing flow and contain the operation, for example, to send the data to a receiver.
Custom Processing Class: V3OutboundCustomStepProcessing
Plug-in custom block before or after Skyvva step (Selection base on your requirement)
Define the time and location where wecan chose to add our custom logic. Our custom logic can be apex class,flow or process. Your customer logic will be executed at the chosen time additinally ti the skyvvva processing Unit.
In contrast to the custom block where the customer completely replaces the whole skyvva step by their own block here there is no need to replace but to plug-in custom logic before or after the skyvva standard block. We have the following plug-in block which could make sense:
- Before Mapping
- Before Workflow
- Before Operation
- After Processing
Replacement Skyvva step by custom block
Name of the SKYVVA standard processing block which is used in the Inbound andoutbound message processing.
The blue color flow and block show the position where the customer can replace their own logic of the skyvva standard step. Each of the four steps can be replaced by a corresponding custom block which can be an apex class. We have different configuration combining through the skyvva standard and custom replacement block.
for examples, customer adds their processing by replacing the skyvva standard step. In the Case 1e customer have the own block for the first step e.g. how to query additional data for the sObject Id passed through the method invokeCallout2(). The other 3 blocks are the skyvva standard block.
In case2 customer replace step 3 by their custom block and do the workflow processing in apex code based on the special requirement.
In case3 customer replace two steps e.g. step 2 and 4 to build their own logic for the mapping and operation step. These are just three examples and another combination is possible based on the customer requirement.)
Mixed case with custom replacement + plug-in block
The above examples show the different type of custom logic enhancement to the skyvva standard step. The first possibility is to replace the whole skyvva step e.g. processing block. The second possibility is to add plug-in logic to the skyvva step/block. Combining these two type we have the mixture use case. Here we can define plug-in logic not only for the skyvva standard but also for the custom block. The Case1, shows that we have the custom block ‘Custom Query Data’ and the plug-in block ‘Before Mapping’. Furthermore, we don’t use the standard skyvva block ‘Operation’ but replace it by the custom block ‘Custom Operation’ and have the before and after plug-in logic, e.g. ‘Before Operation’ and ‘After Processing’. In Case2 we replace the skyvva block ‘Mapping’ by the custom block ‘Custom Mapping’ and have plug-in block before and after the skyvva step ‘Operation’.
How to create Custom class? #
A Custom Class is a developer defined class. If user doesn’t want to use our existing class and want to create his own class then he can add custom block. User can extend our existing class.
Go to set up -> Search for Apex class -> Create new apex class.
Use the following Custom Processing Class: V3OutboundCustomStepProcessing;
[aux_code language=”javascript” theme=”tomorrow” title=”” extra_classes=””]
global class V3OutboundCustomStepProcessing extends skyvvasolutions.V3OutboundStepProcessing{
/*
//Custom Query Operation
global override List<SObject> query(String soql, List<Id> ids){
//Custom Logic
System.debug(‘V3OutboundCustomStepProcessing query method invoked’);
List<SObject> lst=new List<SObject>();
return lst;
}
*/
//Before Mapping
global override IServicesUtil.IMessageResult beforeMapping(IServicesUtil.IMessageResult mr){
//Custom Logic
System.debug(‘V3OutboundCustomStepProcessing beforeMapping method invoked’);
return mr;
}
/*
//Custom Mapping Operation
global override Map<String, Map<String,String>> executeMapping(IServicesUtil.IMessageResult mr, List<IMapping__c> listMapping){
//Custom Logic
System.debug(‘V3OutboundCustomStepProcessing executeMapping method invoked’);
Map<String, Map<String,String>> mX=new Map<String, Map<String,String>>();
return mX;
}
*/
//Before WorkFlow
global override IServicesUtil.IMessageResult beforeWorkFlow(IServicesUtil.IMessageResult mr, Map<String, Map<String,String>> mapResult){
//Custom Logic
System.debug(‘V3OutboundCustomStepProcessing beforeWorkFlow method invoked’);
return mr;
}
/*
//workflow step
global override IServicesUtil.IMessageResult executeWorkFlow(IWorkFlow__c wf, IServicesUtil.IMessageResult mr, Map<String,Map<String,String>> mapResult) {
//Custom Logic
System.debug(‘V3OutboundCustomStepProcessing executeWorkFlow method invoked’);
IServicesUtil.IMessageResult mrX=null;
return mrX;
}
*/
//Before Operation
global override void beforeOperation(List<V3OutboundUtils.MessageTree> msgTrees){
//Custom Logic
System.debug(‘V3OutboundCustomStepProcessing beforeOperation method invoked’);
}
/*
//Custom Operation
global override V3OutboundUtils.Response executeOperation(Adapter__c adapter, List<V3OutboundUtils.MessageTree> msgTrees){
//Custom Logic
System.debug(‘V3OutboundCustomStepProcessing executeOperation method invoked’);
V3OutboundUtils.Response response;
return response;
}
*/
//After Operation
global override void afterOperation(V3OutboundUtils.Response response){
//Custom Logic
System.debug(‘V3OutboundCustomStepProcessing afterOperation method invoked’);
}
} [/aux_code]
When the process start user can change anything or want to add/ remove anything from records then he can add his logic in before class. Every process is executed step by step where we can add our plug in.
V3OutboundStepProcessing methods | Description |
query(String soql, List<Id> ids) | Return List<SObject> that is based on query and given record ids |
beforeMapping(IServicesUtil.IMessageResult mr) | It will be executed if interface is setting <Custom Plug-in to SKYVVA Block: Before Mapping>, return skyvvasolution. IServicesUtil.IMessageResult which 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.IMessageResult mr, List<IMapping c> listMapping) | Mapping processing by default, it returns Map<String, Map<String,String>> , that is mapping result of each message that is specified message-field <External_Id2 c> as key |
beforeWorkFlow(IServicesUtil.IMessageResult mr, 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.IMessageResult mr, Map<String,Map<String,String>> mapResult) | A target interfaces could have an apex class for the logic to filter messages before execution of its adapter operation. skyvvasolutions.IServicesUtil.IMessageResult is 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 |
exe cuteOperation(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> |
Adapter: #
Outbound adapter is needed to push data from salesforce to the external system. We need create an adapter before Interface then we can set adapter to use with interface. There are different adapter available with skyvva.
V3OutboundStepProcessing methods/attributes | Description |
execute(Adapter c adapter, List<V3OutboundUtils.MessageTree> msgTrees) | It is required to override in implement to sending the request (callout), and the return type should be object of skyvvasolutions.V3OutboundUtils.Response if interface outbound has contained inbound response interface. |
getProperties(Adapter c adapter) | Return map as pairs of key-value of adapter’s property such as username, password, endpoint, … |
executeInbound(V3OutboundUtils.Response response) |
It should be overridden if doing inbound processing or execute and DML after callout. |
interfaceOut | skyvvasolutions Interfaces c |
mappings | List<skyvvasolutions IMapping c> |
inputParam | skyvvasolutions.CallOutControl, the parameters are passing from the caller |
outResponse | skyvvasolutions.CalloutResponse, the data that response to the caller (i.e http-response such as JSON, XML) |
Pre-requisite: #
- Create custom class.
- Create Rest/Soap Adapter.
- Create message type as per template.
- Create Integration.
- Create outbound Interface
How to use Custom Step Processing class (Outbound Custom Plugin Enhancement)? #
You need to set properties on Inbound Interface Record:
- Select Custom Processing checkbox.
- Custom Processing Class: V3OutboundCustomStepProcessing
- You need to set two properties on Interface Object:Operation Type: Apex ClassAnd
Operation Type Apex Class: V3OutboundCustomOperation
4. Select Any Step:
[aux_code language=”javascript” theme=”tomorrow” title=”” extra_classes=””]
Custom Plug-in to SKYVVA Block Help: (Selection base on your need)
OR
Custom Block to Replace SKYVVA Block Help: (Selection base on your need) [/aux_code]
5. Go to mapping page. And Do mapping.
6. Go to Developer console and callout.
Execute the following code:
[aux_code language=”javascript” theme=”tomorrow” title=”” extra_classes=””]
skyvvasolutions.CallOutControl c = new skyvvasolutions.CallOutControl();
c.returnJSONComplete=true;
c.actionDoIntegrate=true;
c.isCreateMessage=true;
String[] ids= new String[]{‘0011X00000U5rygQAB’,’0011X00000U5ryhQAB’};
skyvvasolutions.Iservices.invokeCalloutV3(‘Your Integration Name’,’Your Interface Name’,ids,’SYNC’,c);
[/aux_code]
7. You can check the result on message monitoring.