Posts

Extend the Power of Flow with External Services

Lightning Flow already empowers you to declaratively automate your business processes within Salesforce. But what if your business processes require integrations between Salesforce and other non-Salesforce services? Chances are that customer service agents who use Salesforce to track and resolve support cases would also need to access information from and/or submit changes to another backend system. Or perhaps you want a Flow to create a new record in Salesforce as well as post a message in Slack to notify the team. These are scenarios where you can leverage External Services to extend the ability of Flow to automate processes beyond Salesforce!

External Services provides a declarative way to access external business processes, whether they are proprietary APIs, public APIs, or other Salesforce APIs:

For any REST API that you want available as a callout from Lightning Flow, you just need to register the OpenAPI 2.0 specification for that API, so that it will be available as an action in Flow.

Configuring Flow to Integrate with an External Service

To support this integration, you just need to provide Salesforce with the following information:

  1. Named Credentials
    • Where to configure this: Setup -> Named Credentials
    • What these configurations tell Salesforce: Where is the external service being hosted (domain URL), and what credentials do we need to send for authentication?
  2. External Services:
    • Where to configure this: Setup -> External Services
    • What these configurations tell Salesforce: Where the OpenAPI 2.0 specification is located (relative to the domain URL of the Named Credential), and/or what the API specification is. The specification describes what API callouts Salesforce can make to the external service.
  3. Flow Action:
    • Where to configure this: Setup -> Flow
    • What these configurations tell Salesforce: Which action / callout you want to make to the external API, what input parameters you want to send, and what variable you want to use to store the response.

Example

This example shows how to the register the OpenAPI 2.0 specification for the Swagger PetStore API, as well as configure a callout to the PetStore API in Flow:

Named Credential:

External Service:

Flow – Add “findPetsByStatus” action:

Flow – Configure Input Parameters and Store Response:

Learn More

Here are some more resources for you to learn more about External Services:

External Services Trailhead

Katie Kodes’ Tutorial

Flow Use Case – New Task Button with picklist for selecting the record type

When our org migrated to Lightning, we were faced with an interesting issue: we had many task record types and in order to enable our end users to create tasks from the activity composer, we had to create a different quick action for each task record type. The result wasn’t pretty

Too many tabs

Our users wanted a simple button where they could create a task with one click and be able to select the task record type.
When I set out to build the solution, I started by using a Get Records element to query the record type object but soon realized that I can’t filter this list based on the record types available to the current user.

I was able to provide a nice solution using the new invocable action and quickChoice component found here on this site. I used the Get Record Type Info by Object action to generate a list of record types available to the current user. Then I fed the record type labels and Ids into the Quick Choice component. Finally I created the task and used the Navigate to Record action to open the new task in edit mode.

Get the available record types
You need to check this box to store the output value
The new task Id is fed into this action
And this is the completed flow
Here is the end user experience

Preventing duplicate junction object records by GORAV SETH

GORAV SETH demonstrates how you can use the new flow before save trigger combined with duplicate rules to prevent creation of duplicate junction object records.
Check it out

Get Record Type Info by Object – Flow Action

This action can be used to generate a list of record types for a specific object. This can be useful when you would like to present a record type selector to the user. Can be used as inputs to the QuickChoice by setting Input Mode to “Dual String Collections”. Pass in one output collection for Labels and one for the underlying values

Inputs

AttributeTypeDescription
Object NameStringAPI name of the target object example “Task” or “MyObject__c”
ignoreMasterRecordTypeBooleanIf “on” then “Master” will not be added to the list of record types
onlyReturnActiveRecordTypesBooleanIf “on” then only active record types will be added to the list
onlyReturnRecordTypesAvailableToCurrentUserBooleanIf “on” then only record types available to the current user will be returned

Outputs

AttributeTypeDescription
errorsStringcaptures details of any error that occurred
recordTypeIdsStringIds of the records types.
recordTypeNamesStringNames of the record types.
defaultRecordTypeNameString
defaultRecordTypeIdString

Installation

1.1 Unmanaged 5/13/21 – Added outputs for the default Record Type

Source

How to create a Map collection in Flows by Narender Singh

Narender Singh form ForcePanda wrote a two blog series about using map collections in flows. The second blog makes good use of the new generic sObject support in flows coming in the Spring ’20 release

Part 1: https://forcepanda.wordpress.com/2019/12/17/how-to-create-a-map-collection-in-flows-part-1/

Part 2: https://forcepanda.wordpress.com/2019/12/18/how-to-create-a-map-collection-in-flows-part-2flow-map-methods-spring20delight/

Creating a unique collection in flow by GORAV SETH

GORAV SETH shared a quick tip on his blog about a way to create a unique collection in flow
https://goravseth.com/creating-a-unique-collection-in-flow

Navigate to a Record in View or Edit Mode at the end of a Flow

A common need in Flows is to be able to redirect the user to a new record that may have been created in the Flow. This new Lightning Flow Action can be used to redirect the user to the specified record in either View Mode or Edit Mode.

ersNavigateToRecord

Submitting multiple records to Flows by https://xbaf.com

The admins at https://www.xbaf.com wrote a blog on how you can create a list button that launches a flow and pass the selected record ids to be processed by the flow using an undocumented flow variable

How to validate custom Flow screen components in Flows by Narender Singh

Narender Singh form https://forcepanda.wordpress.com posted a series of blogs on how to add validation to custom flow screen components:

Part 1 https://forcepanda.wordpress.com/2019/07/09/how-to-validate-custom-flow-screen-components-in-flows-part-1/

Part 2 https://forcepanda.wordpress.com/2019/07/11/retain-input-values-while-validating-custom-flow-screen-lightning-components-part-2/

Part 3 https://forcepanda.wordpress.com/2019/07/12/adding-validation-errors-on-individual-inputs-in-custom-flow-screen-components-part-3/

Flow Screen Component: Dependent Picklists with RecordType and MultiSelect Picklist support by Narender Singh

Narender Singh created a flow screen component for a dependent picklist tha supports picklist value selection based on the record type.

https://forcepanda.wordpress.com/2019/06/11/flow-screen-component-dependent-picklists-with-recordtype-and-multiselect-picklist-support/