Salesforce integration Patterns & Best Practices

Integration

Join us to learn about different Salesforce integration Patterns and Integration Best Practices. In this session we will talk about different Integration patters like request and reply/response, Fire and forget, Batch Data Synchronization, Remote Call In, Data Virtualization.

It was a mega session and we got the 380+RSVP across the world. In that session we covered few of the aspects of integration, starting from basic & going to advance.

Agenda

  • Why there is need of Integration
  • Security between System
  • Factors affecting Integration Patterns
  • Integration Patterns
    • Request and Reply / Response
    • Fire and Forget
    • Batch Data Synchronization
    • Remote Call In
    • Data Virtualization
  • When to use which integration
  • Differences between various integration mechanisms including Canvas, Outbound messages, REST , SOAP, Bulk APIs
  • When to use ESB vs ETL
  • Demo
  • Q&A

Here is Keynote of session

Why Integration

Salesforce can’t be source of everything. It can be CRM or any Custom application.
However, SAP can own Order management or Inventory, External system for sending email, Other System for Payment, External Fleet Management And possibilities are high that Salesforce would need to exchange data with these systems

Factors Affecting Pattern

  • Maintain same transaction : Does Salesforce need to perform anything on response ?
  • Synchronous vs Asynchronous : Is it business critical & response needs to be processed in real time or near real time ?
  • Message size : Is it small or large ?
  • Guaranteed delivery needed : What if external system is down ?
  • Contract first integration possibility : Can remote system follow Salesforce Contract ?
  • Declarative preferred : Do we want to integrate without writing any code in Salesforce ?

Request & Reply

External Services : Point & click based integration from Lightning Flow. External system should provide OpenAPI or Interagent schema. Only supports primitive datatypes

LWC or Visualforce calling external system : Salesforce enables you to consume WSDL and generate proxy classes. It also provides HTTP services using which we can perform GET, POST, PUT or Delete operations. A user can initiate operation from custom UI.

Trigger : We can make callout to external system on data change via trigger. However callout made must be asynchronous. This solution is not recommended for request and reply but better suited for Fire and Forget.

Batch Apex invoking external services : We can make callout to external system using Batch Apex. Execute method in Batch apex gets refresh governor limit every time however there are governor limits on total callout or time of callout in single transaction

Fire & Forget

  • Process-driven platform events
  • Customization-driven platform events
  • Workflow-driven outbound message
  • Apex based Callouts

Batch Data Synchronization

Change Data Capture : Salesforce publishes change events, which represents changes on records
Using ETL Tool : This tool connects to systems, extract data, transform in require target format and uploads using Bulk API or SOAP API
Manual Remote Calls : Salesforce or external system can call each other every time data is changed. However, it would cause huge ongoing traffic and should be avoided if possible

Batch Integration
Batch Integration

Remote Call-In

  • SOAP & Rest API
  • Apex based APIs

Data Virtualization

Data Virtualization
Data Virtualization

Here is recording of session.

Topic    : Salesforce integration Pattern & Best Practices
Date     : Saturday, FEB 1, 2020 10:00 AM EST (8:30 PM IST )
Speaker : Jitendra Zaa

Further Learning

Please note that we have limit of 300 attendees that can join the online sessions. However, recording will be posted on our YouTube channel. Make sure to subscribe our YouTube channel to get notification for video upload.

Bookmarks our “Session in 2020” page for all upcoming and old sessions of 2020. Let us know which topic you want learn next in ApexHours.

Don’t forget to check Jitendra Udemy course on Mastering Salesforce DX (Modular Application Development Using Unlocked Packages)

If you are new in Salesforce. Please check our free Salesforce Admin and Salesforce Developer training.

Thanks,
Salesforce Apex Hours

6,046 total views, 4 views today

4 comments

  • Hello Experts,

    I need your advice on testing the integration of third party Rest API from apex like below

    public class Testing {
    public final String clientId = ‘xxxxxxxxxxxx’;
    public final String clientSecret = ‘xxxxxxxxxx’;

    public String getD365Customer(){
    String reqbody = ‘grant_type=client_credentials&client_id=’+clientId+’&client_secret=’+clientSecret;
    Http h = new Http();
    HttpRequest req = new HttpRequest();
    req.setBody(reqbody);
    req.setMethod(‘POST’);
    req.setEndpoint(‘https://login.microsoftonline.com/tenant/oauth2/token’);
    HttpResponse res = h.send(req);
    deserializeResponse resp1 = (deserializeResponse)JSON.deserialize(res.getbody(),deserializeResponse.class);
    String atoken = resp1.access_token;
    System.debug(‘Access Token=========’ + atoken);
    //return atoken;

    Http http1 = new Http();
    HttpRequest req1 = new HttpRequest();
    req1.setEndpoint(‘https://dev-mca/data/Customers’);
    req1.setMethod(‘GET’);
    req1.setHeader(‘Authorization’,’Bearer ‘+atoken);
    HttpResponse res1 = http1.send(req1);
    System.debug(‘Response Body=========’ + res1.getBody());
    return res1.getBody();
    }
    public class deserializeResponse
    {
    public String token_type;
    public String expires_in;
    public String ext_expires_in;
    public String expires_on;
    public String not_before;
    public String resource;
    public String access_token;
    }}
    But I am getting the error like
    Line: 23, Column: 1
    System.UnexpectedException: java.lang.IllegalArgumentException: invalid start or end

    Not sure if I am missing something.

Leave a Reply