Lightning Platform Integration Capabilities: The Mini Guide

Dave Norris
Geek Culture
Published in
11 min readDec 2, 2021

In a previous article we discussed the interconnected pieces that make up the Salesforce Platform and summarised the APIs and capabilities.

In this post we’ll double click on the lightning platform to look at its integration capabilities in more depth.

The lightning platform: APIs and key integration capabilities

Salesforce Connect

Using Salesforce Connect to interact with data (patient screening records in this example) stored outside the Salesforce Org.

Salesforce Connect provides seamless integration of data across system boundaries by letting your users view, search, and modify data that’s stored outside your Salesforce org. This can be done without having to replicate the data but have a very similar user experience to data you have replicated.

Salesforce Connect uses the industry standard OData protocol which works to simplify querying and sharing data across disparate systems. OData is a REST-based protocol that builds on HTTP and JSON using URIs to address and access data feed resources in real-time.

To setup Salesforce Connect you have to create an External Data Source that points to an OData endpoint. The service then introspects the schema exposed by the endpoint and allows you to create corresponding External Objects. The final step is to add the External Object to page layouts and, optionally, to link them to Standard Objects.

External objects sync’d from the OData endpoint
Relate fields in the external data source to fields on standard objects.
Adding External Objects to standard page layouts. They look and feel like standard objects but the data is accessed at runtime.

MuleSoft OData API Kit

Salesforce Connect requires an OData provider. If your data source doesn’t natively support OData then MuleSoft provides a way to quickly scaffold and implement one with the API Kit for OData.

By using and Enterprise Data Model XML file (.edmx) and a plugin provided by MuleSoft you can convert the file into an API endpoint with all the scaffolding needed to support GET, PUT, PATCH and DELETE resources. The .edmx file contains the target database schema and defines the mapping between the EDM and the underlying database.

Each resource can then have operations that implement the logic using MuleSoft connectors to transform the inbound OData request into a format that can be used in a DML operation.

The MuleSoft OData API Kit with resources to transform requests and connectors to access your data sources with minimal code.

Think of Salesforce Connect as a no code approach to searching, viewing and updating data stored externally to the lightning platform but conveniently maintaining the user experience of data as if it was stored on-platform. MuleSoft provides an API kit to help create OData providers.

Apex Callout

An Apex callout enables you to tightly integrate your Apex with an external service by making a call to an external Web service or sending a HTTP request from Apex code and then receiving the response. Apex provides integration with Web services that utilise SOAP and WSDL, or HTTP services (RESTful services).

In the picture above you can see a custom lightning web component that is displaying the customers current balance. This information is stored off platform and an apex callout allows data to be retrieved in real-time and displayed on the screen without having to replicate it into the Salesforce database.

Think of Apex callouts as an approach to retrieve data from an API endpoint without having to replicate it into the lighting platform. This allows you to display highly transient data, stored off-platform, and display it alongside data that is stored in your Salesforce org.

External Services

External Services is an integration product that declaratively connects external REST APIs using OpenAPI standards. It brings external web services into the lightning platform where you can use point and click tools like Flow to meet integration use cases without code. An External Service simply inspects the OAS API specification to determine the available methods, input and output datatypes to create the necessary Apex code on your behalf.

Whilst external services is not new. The ability to use MuleSoft APIs to use as the basis for your external service is.

Once created an External Service created invocable actions. These invocable actions are available immediately in the automation tool, Flow Builder. An admin uses Flow Builder to access the invocable flow actions allowing them to call the API and receive the response. Without writing code.

By combining External Services and declarative features like Flow you can craft user experiences that interrogate 3rd party APIs without writing a single line of code.

As an example I used flow and a third party service to convert user input into the corresponding ASCII art and save the results on the record.

Example flow that uses auto generated Apex invocable actions from an OpenAPI spec to callout to a third party.
External Services and Flow in action. Converting user input to ASCII art using a third party API.

MuleSoft as an API Source

As of Winter ’22 you can now import your MuleSoft API specifications as part of the External Service creation process.

Importing MuleSoft APIs directly into an External Service.

Platform Events & Change Data Capture

Enterprises are looking to decouple their distributed systems and are looking to adopt event driven architectures where data exchange is near real-time without the interfaces being tightly coupled.

Publishers and subscribers communicate with each other through events. One or more subscribers can listen to the same event and carry out actions. Your Salesforce Org can support these types of architectures in the following ways.

Change data capture, CDC, allows developers to receive near-real-time changes of Salesforce records, and synchronise corresponding records in an external data store. Change Data Capture publishes change events, which represent changes to Salesforce records. Changes include creation of a new record, updates to an existing record, deletion and undeletion of a record. The change event structure is consistent and contains header fields that contain information about the event, such as whether the change was an update or delete and the name of the object, like Account. Also included is the event-specific field, replayId, which is used for retrieving past events.

Change Data Capture is typically used to notify downstream systems of data changes so take action or to keep data in sync.

Unlike CDC events, Platform Events are developer driven and not tied to database operations. Platform Events have custom payloads and are triggered by Apex code or Flows. This allows developers to create and publish custom event notifications.

A pilot program allows channels to have a field-value filter (applies to Platform Events only). CometD subscribers to the channel receive a filtered stream of platform events, optimising processing.

Change Data Capture and Platform Events are near real-time events that support event-driven architectures by publishing events to a shared event bus. External applications and/or other lightning platform features can subscribe and reply these events, asynchronously, at scale.

New APIs

Salesforce is constantly evolving its API portfolio to provide developers new ways to access their data.

The Composite Graph API evolves the existing composite API. It’s been designed to give a single API call much greater power.

The Mass Operations API is something in pilot to address a common pain points. e.g. You have a large number of records that you want to perform an operation on (like changing ownership). Mass Operations API allows us to make one API call and provide a set of IDs to operate on — these IDs can be in the form of a list or a SOQL query.

Developers using the streaming API subscription services (in the form of pushtopic, generic, CDC and platform events) need to use 3 APIs to publish, subscribe and interrogate schemas. In an effort to simplify things a new Pub/Sub API is now in pilot that aims to provide all that functionality in 1 API. It will also use gRPC (Google Remote Procedure Call).

When it comes to OAS REST specifications for the lightning platform there has been little support. Salesforce has started a journey in pilot to improve this by giving you an endpoint that lets you download an OAS 3.0 specification that reflects your Org’s unique customisations. Currently it is limited support for sObject resources but the vision is to open support further in future releases.

MuleSoft Composer for Salesforce

Simple point to point integrations can unlock a significant amount of value but waiting for development resources is not sustainable. MuleSoft Composer for Salesforce is designed to allow Salesforce administrators to create integrations and logic with a few simple, guided clicks directly inside of Salesforce.

Prebuilt connectors for common back office systems allows you to streamline use cases across Sales, Service, IT and Marketing departments. Here are some use cases that can now be met without a developer skill set.

  • IT — Create a Jira ticket when a Salesforce Case of a certain type opens?
  • Service — Send a text message when a customer’s Work Order progresses
  • HR — Create and Synchronise key employee attributes
  • Sales — Create Orders in your ERP when an Opportunity closes

Data Pipelines

With Salesforce Data Pipelines, you can integrate, enrich, and modify data natively in Salesforce without needing external systems or taking data outside the Trust boundary.

With point and click tooling and machine learning guidance, you can prep and transform your data faster at scale. Admins benefit from working in the Salesforce environment they know, without needing to use complex external infrastructure for common data sync and clean-up needs.

With over 50 out of the box connectors, it’s easy to access data held in external systems, and make your incoming data match your Salesforce schemes. With data processing, complex transformations can be done easily, even for large volumes. Data is ingested in batch and can be started on a scheduled basis or the job can be started using the Tableau CRM REST API.

OmniStudio

OmniStudio is a suite of tools designed to create digital experiences that are best suited to industry-specific use cases. OmniStudio is a suite of task-based components that are native to the lightning platform. DataRaptor and Integration Procedures are 2 components that allow customers to integrate with their data sources more easily — both on and off platform.

DataRaptor provides Salesforce Admins the ability to extract, transform and load data from their Salesforce data model (DataRaptor Extract, DataRaptor Transform and DataRaptor Load). It is most commonly used to interact with other components that come with OmniStudio (namely Cards and OmniScript) to create an interactive User Interface. Cards and OmniScript provide a user interface that can use DataRaptors to carry out database operations — allowing information to be retrieved, shown or written to the database to capture key details.

An Integration Procedure can auto generate an Apex REST Endpoint that can be invoked from external systems. It can also callout to external systems to retrieve data via an HTTP action you define that can also retrieve and transform the resulting payload — important when considering, for example, a communications company interacting with their Order Management System (OMS). A procedure can also be invoked from OmniScript when payloads need a user interface as part of a wider business process. Integration Procedures can also initiate a DataRaptor process too to complete the picture.

Content Management Systems

With CMS Connect you can connect HTML, JSON, CSS, and JavaScript to customize your Experience Cloud site and keep its branding and other content consistent with your corporate website. CMS Connect officially supports Adobe, Sitecore, WordPress, SDL (Tridion) and Drupal.

With CMS Connect implemented you can then provide relative paths to:

  1. HTML. An example would be header and footer html snippets.
  2. JSON (lists and items). An example of an item would be a blog post — when it displays it’s the full blog post. A content list is a grouping of items such as a series of blogs and when it displays it’s a title and summary with a link to the full post
  3. Cascading Style Sheets (CSS) — to provide a consistent look and feel
  4. JavaScript — to reuse code fragments

With Salesforce CMS customers have the option to create content in Salesforce and share it with other properties in the Salesforce ecosystem and internally within their corporate experiences. Salesforce CMS is a hybrid CMS, which means your teams can create content in a central location, and syndicate it to any digital touchpoint, whether it’s an experience powered by Salesforce or another system.

AppExchange

For integration use cases our partners have made available applications that can integrate to payment gateways, survey tools, document management solutions, marketing tools and many more.

Amazon AppFlow

Amazon AppFlow is an integration service from AWS that enables you to transfer data between cloud apps such as Salesforce and AWS services like Amazon Simple Storage Service (Amazon S3), Amazon EventBridge, and Amazon Redshift with a few clicks. You can also use AppFlow to create new records in Salesforce using data stored in an Amazon S3 bucket. Data flows both ways.

Using Salesforce as a data source an AWS administrator can choose to schedule a pull of information or use change data capture events to provide a real time stream of changes being made in your Salesforce Org. AppFlow provides some basic validation and transformation capabilities.

Amazon Connect

Amazon Connect is a cloud-based service made to simplify your contact centre.

The Amazon Connect Computer Telephony Integration (CTI) Adapter for Salesforce simplifies the roll out of an integrated telephony system. Receive incoming calls and make outgoing calls right from Salesforce. The CTI Adapter provides a browser-based contact control panel (CCP) within the Salesforce Lightning, Console, and Classic CRM experiences. This feature includes both inbound caller ID screen pop-ups and outbound click to call/transfer/conferencing.

The Amazon Connect CTI integration consists of two components, a managed Salesforce package and an AWS Serverless application, which can be deployed to your AWS environment. The collection of pre-built utilities enables integration between these two platforms. The AWS Serverless application package contains a set of common Lambda functions to be used by Amazon Connect to interact with Salesforce. This allows you to embed call recording in the Salesforce record, automatically clean up open tabs to improve agent efficiency and sync state between Salesforce and Amazon Connect.

Summary

Integration capabilities in the lightning platform cover ETL, transactional and event-driven use cases. These capabilities allow developers to create bespoke user experiences with the least friction possible.

--

--

Dave Norris
Geek Culture

Developer Advocate @ Salesforce || Interested in solving unique challenges using different cloud service providers || All opinions are mine.