Flow
This is the feature to provide the post-processing logic using Salesforce Flow and Process Builder. Therefore we pass to the Flow/Process the sObject Id which has been created, updated or deleted by the interface operation.
How to create flow?
Follow the gien step to create salesforce flow:
Step1: Create Apex Class
global with sharing class TestInvokeWorkflow {
@InvocableMethod
global static void updateMessage(List<ClassProperties> myDto){
try{
List<Account> lstAcc = new List<Account>();
List<skyvvasolutions__IMessage__c> lstMsg = new
List<skyvvasolutions__IMessage__c>();
List<skyvvasolutions__IMessage__c> lstUpdate= new
List<skyvvasolutions__IMessage__c>();
for(ClassProperties dto: myDto){
lstAcc.addAll(dto.myListAcc);
lstMsg.addAll(dto.myListMSG);
}
for(Integer i=0;i< lstAcc.size(); i++){
if(lstAcc[i].Id !=null){
lstMsg[i].skyvvasolutions__Status__c = ‘Completed’;
lstMsg[i].skyvvasolutions__Comment__c = ‘Success from flow’;
lstUpdate.add(lstMsg[i]);
}else{
lstMsg[i].skyvvasolutions__Status__c = ‘Failed’;
lstMsg[i].skyvvasolutions__Comment__c = ‘Failed from flow’;
lstUpdate.add(lstMsg[i]);
}
}
update lstUpdate;
}catch(Exception ex){}
}
global class ClassProperties{
@InvocableVariable(Required = true)
global List<Account> myListAcc;
@InvocableVariable(Required = true)
global List<skyvvasolutions__IMessage__c> myListMSG;
}
}
Step2: Create a flow with type autolaunched
Go to Setup and search for flow in Quick find/Search
- Create new flow with name customerflow
How to use flow?
Create new integration and interface
We create a new interface with:
– Operation type : Autolaunched Flow
– Source/Target Name: Account
– Custom Flow: customerflow
– Do mapping (Account)
Go to interface Detail:
Scroll down the page to mapping section>
Step4: Push data by Manual Load:
We choose Account as a sample data.
Push the selected data and click on message board button.
Step5: We can check on message board:
When we push uploaded data, we can see the result on message monitoring page.
Apex Class
In Apex, user can define top-level classes (also called outer classes) as well as inner classes, that is, a class defined within another class. You can only have inner classes one level deep.
public class myOuterClass {
// Additional myOuterClass code here
class myInnerClass {
// myInnerClass code here
}
}
follow the given steps to use apex class:
Step 1: Create Integration
Step 2: Create interface
– Select operation Type: Apex class from drop down
– Save
Step 3: Create this class is used for Apex Custom class on Interface and Click on wrench icon and click on Setup.
- Write Apex Class in Quick find box
- Click on Apex Classes under Custom Code drop down
- Write this class is used for Apex Custom class in interface
- Quick save
- Make sure your code has been saved successfully
- Create this class is used for testing operation type Apex
- Go to Interface Detail Page
- Select TestCustomApexClass
- Save
- Scroll down to Mapping Section
- Select Ext ID
- Save
- Go to Integration Detail Page
- Select Manual Load
- Select Integration Name& Interface
- Select Data Type
- Select CSV Separator
- Choose file & upload
- Select all records
- Press Push button
- Go to Message Board
- Select your Integration
- Select your Interface
- Press Search Button
- Scroll down to Message section
- See status Green Flag which means user inbound apex class operation successfully
done - All records are integrated with Salesforce Org.