External Services is a Salesforce integration method that lets you seamlessly connect external web services to your Salesforce org without coding.
In today’s world, customers expect integrated experiences across multiple platforms and services. External Services facilitates this by declaratively integrating external APIs and computations into Salesforce using industry standards like OpenAPI.
This allows you to harness specialized external services in areas like credit scoring, eligibility checks, payments, mapping, notifications, omnichannel retail, and more…
Today, we are going to talk about External Services and how you can use them in your Salesforce implementations. We will discuss the usage considerations, benefits, and limitations of this relatively new feature of the Salesforce platform. So, let’s dive in!
Benefits of External Services
- Less boilerplate code: Salesforce’s External Services generate Apex classes encapsulating the API operations of the external service, allowing them to be employed throughout various parts of your Apex code. This encourages code reusability and minimizes duplication.
- Streamlined development process: Through the use of External Services, integrations can be created quickly by importing the OpenAPI specification of the desired external service. This leads to the automatic generation of Apex classes and methods by Salesforce, facilitating straightforward invocation of the service.
- Elimination of redundant code: By offering a standardized way to connect with external APIs, External Services simplifies the process of integration. This means that there is no longer a need for repetitive code for handling HTTP requests, authentication, or parsing responses.
- Compatibility with Flows: The added benefit of External Services is that they can be directly invoked through Flows. This makes them handy for administrators and consultants working with Salesforce – even without an in-depth understanding of coding.
- Maintainability: Should there be any changes to the external service’s API specification, updating the External Service definition in Salesforce will cause the Apex classes to be regenerated. This ensures that your code remains in alignment with the latest changes in the API, making maintenance easier and keeping your integrations current.
External Services Structure
In a nutshell, using External Services begins by registering an external web service and submitting its OpenAPI specification. This defines the operations of the service. A named credential is used for endpoint URL and authentication details.
Then, the platform begins converting the operations into invocable actions for use in Salesforce tools like Flow Builder.
This enables clicking, not coding, to connect to External Services. Once registered, the external service operations become building blocks you can add to Flows and other tools.
When a Flow runs, it invokes the external service actions to exchange data. This allows seamless integration without writing complex code.
Examples of Valuable External Service Integrations
Here are some examples of how External Services can be used:
- Integrate a credit scoring service into account pages to show credit limits.
- Check eligibility for discounts via an external verification service.
- Incorporate flexible digital payment services for orders.
- Bring in mapping services with visualization for territory planning.
- Get real-time order notifications in Slack through an external service.
- Connect with an external fraud detection service for transactions.
- Unify separate omnichannel retail solutions into one Salesforce experience.
Key Concepts and Terminology
Here are some key terms useful for understanding External Services:
- External web service: A service hosted outside Salesforce, exposed via a REST API.
- API specification: Defines the operations of an external web service. Uses OpenAPI standards.
- OpenAPI specification: JSON-based format for API specs. It can be read by humans and machines.
- Invocable actions: For Flows, these are building blocks generated from an external service’s operations. Used in Flow Builder. They can also be used with Apex and REST API.
- Flow Builder: Tool for creating automated Flows using invocable actions.
- Flow: Automation created with Flow Builder. Collects data and performs actions.
External Services have growing use cases and features. These range from their usage in OmniStudio assets to Einstein Bots that support outbound callouts using External Services.
However, creating schemas and updating them can be challenging for admins and OpenAPI schemas, which define REST APIs and carry significant potential but are not widely adopted.
Creating and maintaining OAS schemas is difficult if they can’t be auto-generated and updated automatically. If more tooling becomes available to generate schemas and more flexibility becomes available, this would greatly help with product adoption.
External Services have additional limitations that one should consider before an implementation…
Considerations for External Services
Protocols: A Narrow Lane
The road starts with the types of APIs and protocols that External Services can understand. It’s mainly tuned to RESTful APIs described by OpenAPI 2.0. If you’re looking to work with something else, like SOAP, you might find yourself hitting a wall.
Authentication can be a tricky affair. Though External Services handles basic authentication, more complex methods like OAuth2 might require you to roll up your sleeves and dive into custom coding or third-party solutions.
Complex Data Types (Maybe Too Complex!)
Don’t expect smooth sailing if you need to handle intricate data structures. Mapping and managing nested objects or arrays may call for extra legwork. It’s a bend in the road that might slow you down but not necessarily stop you.
Error Handling Maze
When it comes to error handling, External Services offers only a basic map. Should the external system’s API hit a snag, finding your way through the error details might feel like wandering through a maze.
Throttling and Rate Limiting
Just like rush-hour traffic, there are constraints on callouts, limiting simultaneous connections and total time taken. If you’re working in a high-volume scenario, you may feel the pinch.
My personal experience with External Services has been mixed. While it’s very useful for simple integrations, I found its limits and restrictions as I continued using it.
For example, response headers and form parameters are not supported, both of which are in Declarative Webhooks. External Services also does not support inbound callouts for webhooks and templates. This doesn’t allow any custom integration that relies on two-way integration between two systems.
There are also possible issues with the charset and names of dynamically created Salesforce classes, although recent releases have helped with these limitations.
You also cannot use record-triggered flows when using External Services, although you can use it in screen flow and others. External Services also do not allow automapping and creating templates from JSON, which is comparatively easy to do with Declarative Webhooks.
There are also other minor issues – as a developer, I remember I couldn’t set an external service-generated Apex class as the data type for a property of a screen flow’s Lightning web component.
However, External Services and other low-code tools are getting better. For example, External Services started supporting the use of bearer token, which is used widely by many integrations whenever you’re doing a callout.
Overall, while hopeful about these tools and being sure they will get better over time, I do suggest being aware of their limitations.
Maybe you don’t want to wait for these features to be developed or simply work with a better tool to build complex integrations. If that’s the case, you can always give Declarative Webhooks a try.
If you’re looking to learn more about development or any topic about Salesforce, feel free to join me and others at SFXD, a community of Salesforce professionals. We currently have 10,000+ members, with a very active core membership connecting every day on our Discord server.