Learn MOAR in Summer ’22 with External Services & API Updates : Andrea Guzman

Learn MOAR in Summer ’22 with External Services & API Updates
by: Andrea Guzman
blow post content copied from  Salesforce Developers Blog
click here to view original post

Follow and complete a Learn MOAR Summer ’22 trailmix for admins or developers by July 31, 2022, 11:59 pm PT to earn a special community badge and enter for a chance to win one of five $200 USD Salesforce Certification vouchers. Restrictions apply. Learn how to participate and review the Official Rules by visiting the Trailhead Quests page.

When it comes to Salesforce development, automation and integration go hand in hand, which is why we’re excited about the latest updates to the Salesforce APIs. On top of this, External Services has continued to expand as a Salesforce Platform feature, giving customers the ability to automate across multiple systems without having to write custom code. In this blog post, we’ll take a look at all of the new features in External Services, as well as some fantastic API updates, available in the Summer ’22 release.

External Services updates

Using External Services, developers and admins can take a process that sits behind an OpenAPI specification and accelerate the creation of actions that invoke functionality in other systems from within Salesforce. This provides a valuable way to leverage Salesforce process automation tools to automate and integrate anything.

Call External Services natively from Apex

Your external services are now more reusable than ever! With this release, you can call your External Services registered actions directly from Apex. This process is similar to making a callout to an external service with the Apex Http Class, but without writing boilerplate code. This removes the overhead of having to write an integration multiple times across your org. Previously, External Services registered actions were only available through Flow or Bots.

Using the API spec from a fictional bank web service, the below Apex code highlights the classes that are automatically created when you register the schema in External Services.


Bank Service API spec

  "paths": {
    "/accounts/{accountName}": {
      "get": {
        "operationId": "getAccount",
        "summary": "Retrieves an account",
        "description": "Retrieves the account with specific name",
        "parameters": [
            "name": "accountName",
            "in": "path",
            "required": true,
            "description": "Name of the account",
            "schema": {
              "type": "string"
        "responses": {
          "200": {
            "description": "The response when system finds an account with given name",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/accountDetails"

Bank Service External Services Registration

Bank Service Apex code
All of the classes you need are automatically created when you register the schema as an External Service. They are also accessible in the External Services setup page in your org. In this example we have the. getAccount, getAccount_Request, and getAccount_Response methods

//Call External Services registered actions from Apex

//Instantiate the External Services Apex class 
ExternalService.bankService service = new ExternalService.bankService();

//Set request
ExternalService.bankService.*getAccount_Request* request = new ExternalService.bankService.getAccount_Request();
    request.accountName = 'KevinWong';

try {
    //Make Callout
    ExternalService.bankService.*getAccount_Response* response = service.*getAccount*(request);
    system.debug ('200 response: id -->' + response.Code200.id);
    system.debug ('200 response: available balance -->'+ response.Code200.availableBal);
}  catch (ExternalService.bankService.getAccount_ResponseException exc){
        system.debug('404 response: error message --> '+ exc.Code404.errorMessage);

Update existing schemas connected to Flow

If a registration is in use by a flow or in Apex (bots coming soon!), now you can update it with a new, compatible API specification version. Previously, you couldn’t update a registered schema that was in use by a flow. If the new schema version isn’t compatible, the edit workflow notifies you of which operations and schema objects are in use, by which flows, and by which Apex classes. With this information, you know which existing references are incompatible, so that you can remove them before saving your updated registration.

External Services Edit Screen

API updates

There are a number of API updates available in the Summer ‘22 release, including updates to the Bulk API and the User Interface API.

Bulk APIs

The Bulk APIs have received some great updates that give you more appropriate Apex limits to support large-scale asynchronous workloads, including changing the CPU time limit from 10 seconds to 60 seconds. This will give you the ability to really innovate on the platform with confidence that large scale integrations will be successful.

User Interface API

The User Interface API now has the ability to get record data for a related list or batch of related lists. You can access these via the API directly by sending a post request to /ui-api/related-list-records/ or /ui-api/related-list-records/batch/. You can also access these APIs directly from your Lightning Web Components using the new wire adapters for getting related list records and info.

This module includes new wire adapters to get records and metadata for a batch of related lists:

  • getRelatedListRecordsBatch — returns record data for a batch of related lists
  • getRelatedListInfoBatch — returns metadata for a batch of related lists

These wire adapters to get records, metadata, and record count for a related list are now generally available:

  • getRelatedListRecords — returns record data for a related list
  • getRelatedListInfo — returns metadata for a related list
  • getRelatedListsInfo — returns metadata for related lists in an object’s default layout
  • getRelatedListCount — returns the record count for a related list

This example gets a related list list from a record and passes in the parentRecordId and relatedLIstParamaters to the getRelatedListRecordsBatch wire adapter.

import { LightningElement, wire } from 'lwc';
import { getRelatedListRecordsBatch } from 'lightning/uiRelatedListApi';

export default class LdsGetRelatedListRecordsBatch extends LightningElement {
    @wire(getRelatedListRecordsBatch, {
        parentRecordId: '001RM000003UNu6YAG',
        relatedListParameters: [
                relatedListId: 'Contacts',
                fields: ['Contact.Name','Contact.Id']
                relatedListId: 'Opportunities',
                fields: ['Opportunity.Name','Opportunity.Amount']

Other Notable Features

  • There is now a 401:GONE Error Code when a service has been removed or retired.
  • The GraphQL API is now in Beta.
  • Legacy API Versions 7.0 through 20.0 are now retired.
  • Legacy API Versions 21.0 through 30.0 are being retired in Summer ‘23.

Learn more about all of the API updates in the API Updates and New Features in the Summer ’22 Release Notes.

Learn MOAR this week

Product Managers and the Developer Relations team are back to share the latest features and functionality in Summer ‘22. To help you develop faster, new content from Developer Relations will cover their favorite new features. Also, be sure to check out Release Readiness Live on Friday, May 20, 2022 at 9:00 a.m. PST. Lastly, keep an eye on the Salesforce Developers blog every day this week for more posts on Summer ’22!

To learn even more, check out the Summer ’22 trailmix.

About the author

Andrea Guzman is the Product Manager for External Services. She works on Salesforce integration products that harness API industry standards to generate declarative building blocks on the Salesforce Platform, empowering developers and admins to build cross-system integrations and workflows. When Andrea is not working, she enjoys traveling, hiking, and playing soccer.

Stephan Chandler-Garcia is a Senior Developer Evangelist at Salesforce. He focuses on application development, security, and Experience Cloud. You can follow him on Twitter @stephanwcg.

The post Learn MOAR in Summer ’22 with External Services & API Updates appeared first on Salesforce Developers Blog.

May 20, 2022 at 09:30PM
Click here for more details...

The original post is available in Salesforce Developers Blog by Andrea Guzman
this post has been published as it is through automation. Automation script brings all the top bloggers post under a single umbrella.
The purpose of this blog, Follow the top Salesforce bloggers and collect all blogs in a single place through automation.