Salesforce integration

Salesforce offers a widely-used platform customer relationship management. Integrating the capabilities of Saleforce into OpenFin applications is a popular requirement. The Salesforce integration from OpenFin enables connections in both directions between custom Salesforce components and applications that run in OpenFin Container.

The integration consists of two npm packages:

  • @openfin/salesforce-lwc: Enables custom Salesforce components to use OpenFin APIs.
  • @openfin/salesforce: Enables OpenFin applications to access, query, and retrieve Salesforce data, as well as call the Salesforce REST API.

Using OpenFin APIs from custom Salesforce components

Normally, when you build a web component using the Salesforce Lightning Components Framework, the Lightning Locker security feature prevents it from using any non-core web APIs, including those from OpenFin. The @openfin/salesforce-lwc package enables you to call OpenFin APIs.

Getting started with this package requires the following steps:

  1. Add the OpenFin library to your Salesforce org as a static resource.
  2. In your web component, run a preload script that calls PrepareFinApiInPreload().
  3. Load the static resource as a third-party library.
  4. Call initFinApiInLwc() before calling any other OpenFin APIs.

For further details and examples code, refer to the @openfin/salesforce-lwc package readme.

Using Salesforce from OpenFin applications

Using the @openfin/salesforce package, you can connect OpenFin apps with Salesforce and enable them to do the following:

  • Initiate authorization to access a nominated Salesforce org.
  • Find Salesforce Accounts and Contacts by performing search queries.
  • Retrieve full object data for a given object ID and type.
  • Execute custom requests with the Salesforce REST API.

This JavaScript API utilizes the Salesforce REST API and OAuth 2.0 to provide secure interoperability between an app running in OpenFin Container with any Salesforce org.

Getting started with this package requires the following steps:

  1. Define a "connected app" in your Salesforce org.
  2. Enable CORS for when your app uses the Salesforce REST API.
  3. In your application, import and run the connect() function to connect to your Salesforce org.

For further details and example code, refer to the @openfin/salesforce package readme.

Did this page help you?