Start tracking your progress
Trailhead Home
Trailhead Home

Get Started with External Services

Learning Objectives

After completing this unit, you’ll be able to:

  • Explain what an external service is.
  • Identify use cases for external services.
  • Describe the high-level flow of an external service.

Why External Services?

External Services is a feature within Salesforce that leverages declarative tools to connect to an external endpoint, such as a credit service provider, and bring its logic into Salesforce. Before we get into detail about what External Services is and how it works, let’s discuss why you might use the feature. Here are just a couple of examples.
  • Make your new Salesforce org users automatic collaborators for external, org-related applications. Maybe you want users to have access to a payroll information app so that they can look up their own timesheet and pay data. You can register an external service and create a flow with triggers that takes inputs such as user ID. When you create a user, the triggers fire and add the user as a collaborator who has access to the payroll app.
  • Connect to a credit service that determines if credit is extended to an account in your org. You can register your external service and create a flow that includes inputs like order amount and credit terms. When the flow runs, it updates the credit terms for the order associated with the account.
There are many other applications for using External Services. In fact, there are probably as many applications as there are external service providers. Once you learn the basics, you can determine what your business cases are and use this feature as you need.

Let’s move on to learn more detail about what External Services is.

What Is External Services?

With External Services, you use declarative tools to import Swagger or Interagent-based API definitions right into Salesforce using a schema. Once you import the definitions, you can create a flow based on the Apex classes generated from your External Services registration...

Hold on!

While these terms—Swagger and Interagent definitions, API, and Schema—are geared toward developers, we don’t leave admins in the lurch. In the coming units, we walk you through a schema definition, help you use declarative tools to register an external service, and get you going on creating a simple flow, so hang on.

In the meantime, let’s look at the big picture via a handy diagram to see how External Services works. (And don’t worry—we don’t quiz you about APIs or Interagent schemas.) While we’re looking, though, notice that much of the work to register an external service of your own is done declaratively via the External Services registration page and Lightning Flow.
Graphic depiction of the External Services process.
Here’s the gist of what’s happening. As you work your way through the units in this module, we cover each step in more detail.
  1. An external services provider, such as a bank, shares its REST-based API schema specification. (If you don’t know what REST is, that’s OK.) Think of this specification as a type of technical contract.
  2. Based on the specification, a developer (or maybe even you) creates a schema definition that describes the API.
  3. A Salesforce administrator declaratively creates a named credential to authenticate to the service’s endpoint using the URL provided by the external service provider. The endpoint is simply what exposes the web services resources that External Services needs to interact with.
  4. A Salesforce administrator declaratively registers the service and uses both the named credential and schema definition during the registration process. External Services automatically imports the definitions into your org and generates Apex actions, which are available immediately in Lightning Flow.
  5. A Salesforce administrator declaratively creates a flow using the External Services–generated Apex actions.
  6. Users run the flow. During runtime, External Services sends a callout to the service’s endpoint. The service returns output based on the schema definition.
  7. Data is retrieved, created, updated, or deleted.
It’s true that you need a schema definition, and that creating one is not a declarative process. Depending on your background, you can create the schema definition, or have your developer do this. In the next unit, we cover the ins and outs (or more accurately, the inputs and outputs) of a schema definition and what it is. After your schema is defined, you can use the declarative tools already in Salesforce to pull the data you need into your org.