Salesforce External Services



Hello Trailblazers, 

Today we will discuss about another no/low code feature of Salesforce – External Services. Whenever delivering an application if you can provide 360-degree view of products or services on a single platform then it becomes important factor which can affect customer satisfaction in positive way. And integrations help us in achieving the same by allowing us to connect to various services to get data or process data. In traditional approach we were using apex classes to implement REST integration with the help of endpoints and other necessary details. But Salesforce has now come up with External Services with the help of which you can connect your Salesforce Org to any RESTful service with the help of API Specification.

So now onwards whenever you have to call any external web service just perform below steps and you will be able to connect your org without any code –

  1. Get API Specification File* from web service provider
  2. Create Named Credentials
  3. Register your web service using External Services
  4. Use Flows or Einstein Bots for invocation of operations supported by that web service
*API Specification file – This is JSON formatted file which describes the web service. This includes all information of the API such as end-point, authentication type, operations supported along with request and response parameters related to those operations. This file uses OpenAPI JSON format. You can request for this file from web service developer or you can create using OpenAPI structure. Sample API spec file can be seen here.
You can read more about OpenAPI specification on Swagger.

Now let’s use above specification file to register external service

Named Credentials

Create Named credential with URL as https://th-external-services.herokuapp.com and Authentication Protocol as No Authentication since no authentication is provided with API Spec file.



Do not change anything else and save it.

Register External Service 

Now open External Services from setup and click on new External Service. 


We will be using API spec file and Named Credential in this step to register service. Use Name Credential created in previous step. 

For Service Schema – select option Service Schema Relative URL if API Specification file is given by web service provider and is hosted on same end point. You have mention path to this schema file in input box where base path would be your end point mentioned in Named Credential. 

Or you can just paste the API Spec file JSON directly with the Service Schema Complete JSON option.


For this demo we will be using relative URL. 
After entering above details click on Save & Next. 
Next screen will list down all the operations that are supported by this API obviously which are mentioned in API Spec file.


You can select all or some operations as per your requirement from this screen. 
After clicking on Next you will see list of all actions with summary which will be available for you in flow builder for use. Click on Done and now your web service is ready for use in flows.

Flow Builder  

In the flow builder use Action element to invoke the external service actions. In the Action element use Type filter and you can see External Service option there. Now you can select desired operation from list of available actions.


Going ahead you can set input values and store output values in flow variables. 


You can use these operations for implementations as per your business requirements.




Comments

Popular posts from this blog

Salesforce Flow - Create multiple records from user input

Scan barcodes from Salesforce Mobile App

Zip or Unzip Files in Salesforce