×
Your Comprehensive Guide to Salesforce Integration

grid-sa-1631106658integration-with-salesforce1701176293.jpg


Your Comprehensive Guide to Salesforce Integration

In today's fast-paced business landscape, data and system connectivity are essential for success. Salesforce, a powerful Customer Relationship Management (CRM) platform, offers a robust set of tools for integration, enabling seamless data flow between Salesforce and external systems.

Table Of Contents :

Salesforce Integration is the process of connecting Salesforce with external systems to exchange data and automate business processes. It is important because it allows data synchronization, real-time updates, and seamless collaboration between Salesforce and various applications, databases, or services.


  1. Salesforce supports several integration patterns, including:
    • Point-to-Point Integration: Direct integration between Salesforce and a single external system.
    • Middleware Integration: Integration using middleware platforms like MuleSoft, Dell Boomi, or Informatica Cloud.
    • API Integration: Utilizing Salesforce APIs (REST, SOAP, Bulk, Streaming) to integrate with external systems.
    • Event-Driven Integration: Integrating Salesforce with messaging systems or event-driven architectures.
    1. Setting Up Integration with External Connected Apps, Remote Site Settings, Named Credentials and OAuth 2.0 Authentication
  1. Remote Site Settings

    Salesforce allows you to access external website resources from a Salesforce application for your organization. You can access these external websites through Visualforce pages, Apex Callout, and via XmlHttpRequest calls. To avoid accessing malicious websites from Salesforce.com, the website first needs to be registered with remote site settings. Once the site is registered, it can be used within Salesforce.com.

    To register a new site, follow these steps:

    1. Navigate to Setup > Administer > Security Controls > Remote Site Settings.
    2. Click on the Remote Site Edit button to add a new site:
    It will redirect you to a new page where you have to fill in the required information to register the new site. The description of various fields is as follows:


    Named Credentials

    Using Named Credential, we can make call out to external system without supplying username or Password

    A named credential specifies the URL of a callout endpoint and its required authentication parameters in one definition. To simplify the setup of authenticated callouts, specify a named credential as the callout endpoint.

     

    To create Named credentials go to Setup–> Enter Named credentials –> Click on New

    check “Start Authentication Flow on Save” and click on Save. After clicking on “Save” new page will open to authenticate Salesforce Org using OAuth2 connected App. If authentication is success, you can see message like “Authenticated as <Salesforce Username>” as shown in below image.

     

    syntax to use Named Credential

    callout:[Named Credential Name]/[Callout URL of other Salesforce Org]

    benefits of using Named Credentials:

    • A named credential specifies the URL of a callout endpoint and its required authentication parameters in one definition.
    • You can skip remote site settings, which are otherwise required for callouts to external sites, for the site defined in the named credential.
    • Using Named Credential, we can make a call out to an external system without supplying username or Password in the code.
    • By separating the endpoint URL and authentication from the callout definition, named credentials make callouts easier to maintain. For example, if an endpoint URL changes, you update only the named credential. All callouts that reference the named credential simply continue to work.
    Differences between Remote site settings and Named credentials:
    Connect one salesforce Org with another using connected Apps

    So before proceeding let's talk about the Source and target org. Let's say I want to integrate the source org A with target org B. In order to establish the connected between source and target org first we need to expose target org B to source Org A, so that source org can access the resources of target org and for this purpose we will use connected apps in target org B exposing it to org A.

    Let's take a brief look what is connected app.

    A Connected app is an application that can connect to salesforce.com over Identity and Data APIs. 

    Connected Apps use the standard Oauth 2.0 protocol to authenticate, provide Single Sign-On, and acquire access tokens for use with Salesforce APIs. Connected Apps are designed to replace Remote Apps, which are now obsolete.

    To create a connected app in salesforce follow below steps:

    • In Lightning Experience, use the App Manager to create connected apps. From Setup, enter App in the Quick Find box, then select App Manager. Click New Connected App.
    • In Salesforce Classic, from Setup, enter Apps in the Quick Find box, then select Apps (under Build > Create). Under Connected Apps, click New.
    • Select Enable OAuth Settings.


    • From Available OAuth Scopes, add Manage User Data via APIs (api), and Perform requests on you behalf at any time (refresh_token, offline_access). These settings allow source org to access the target org logged-in user’s account using APIs, such as REST API and Bulk API. They also allow target org to refresh the token if it has expired, up to the expiration date of the refresh token itself, which can be configured on the Connected App. Click Save and continue.
    • Get Consumer Key and Consumer secrete by clicking on Manage Consumer Details button.



    • Copy the generated Consumer Key and Consumer Secret of Target Org.
    • So exposing target org part is done. Congratulations !. But wait don't get too excited now we need to provide the credentials of target org to source org so that source org can access the data of target org and for this purpose we will use Auth. providers on source org. Let's take a look what it looks like.
    • First, we select the Provider type. In our case we are integration a salesforce org so Provider type will be salesforce.
    • Now we need to create a Named Credential on the source org so that we can authenticate the target org. In this case if we have not provided the correct callback url in connected app of target url then we will get following error while creating a named credential.
    • To solve above error we copy the correct callback url from the Auth provider of source Org and paste it in the connected app callback url of target org.


    • Once done with callback url, try saving the named credentials you created on Source org. Once you save youre named credentials it will redirected to Target Org Login page where it will ask for the permission.
    • Click Allow and you are done !.
    Conclusion

    Salesforce integration opens up a world of possibilities for businesses to streamline processes, enhance customer experiences, and make data-driven decisions. By understanding the fundamentals of Salesforce integration, setting up secure connections, and following best practices, you can harness the full potential of this powerful CRM platform.

    Remember, successful integration is not just about connecting systems; it's about creating synergy and driving business growth. So, embark on your integration journey with confidence, and unlock the true value of Salesforce for your organization.

    Happy integrating!