API V5 for Flow Development Guide

With API V5 for Flow, admins can manage their content and customize their management processes in powerful, new ways.

Use API V5 Flow for these actions.

  1. Import Content Templates
  2. Connect external content builders to Account Engagement
  3. Copy content and assets between business units
  4. Copy assets from Sandbox to Production orgs and vice versa

Salesforce Flow is a business automation service whereby admins can build out different processes. Admins can use Salesforce Flow to craft custom user interfaces, create custom tasks, call automated workflows, and schedule automated workflows.

This guide focuses on screen flow use cases. To uncover additional possibilities that use Salesforce Flow, and to learn more about flow in general, refer to these Trailheads:

  1. Flow Trail
  2. Schedule-Triggered Flows
  3. Flow Types

This guide assumes you have a baseline understanding of Salesforce Flow. Flow will seem familiar to users of Engagement Studio, in that it also includes:

  1. A Visual Builder Interface using a Canvas
  2. Top-to-Bottom Workflow using Steps
  3. Salesforce Object Triggers (Flow doesn’t have the concept of triggers within a flow)
  4. Three basic concepts for screen flows:
    • Screens - Used to Interact with User and Gather Input
    • Actions - Used to Retrieve Data or Execute an Action
    • Conditions - Used to create criteria to determine a path

Because it’s designed for general processes, Flow is more advanced than Engagement Studio. Note these capabilities.

  1. Define objects
  2. Add custom actions
  3. Perform loops
  4. Package Flows

API V5 is integrated into Flow using Apex Invocable Actions, which expose the Account Engagement API to Flow. With Flow, you can perform these general functions.

  1. Generate Picklists
  • Use: A user can search for and select a record.

  • Input:

    • Object Name
    • Business Unit ID
  • Output

    • JSON String of Content Name, Content Record IDs
  1. Create an Asset
  • Use: Creates a new content record.

  • Action Naming Schema: Create X Record

  • Input:

    • Asset ID
  1. Read an Asset
  • Use: Retrieve all the data for an asset.

  • Action Naming Schema: Read X Record

  • Input:

    • Asset ID
  • Output:

    • Content Record

To store the results of the Read and Create actions, each supported object needs an associated Apex Defined Object Class to represent the data in the object.

  • Access to Salesforce org with Marketing Cloud Account Engagement
  • User Access to build and run Flows
  • User Access to relevant business units
  • Install the latest Marketing Cloud Account Engagement Managed Package
ActionDescriptionAPI ObjectInputsOutputsAdditional Details
Get My Business UnitsRetrieves the list of business units relevant to a given user.Business Unit ContextN/APicklist Output (Object List)
A list of business units names and IDs.
The results only include the business units that the active user of the flow has access to.
Get Dropdown OptionsRetrieves a list of options for the given object and business unit.MultipleBusiness Unit ID (String)
The ID of the business unit to access.

Query Object (String)
The V5 API name of the object that you want to retrieve dropdown options.

Field Parameters (String - Optional)
The fields to use for the name and value for the dropdown. The default is "id, name" and, for most objects, doesn’t require a change.
Picklist Output (Object List)
The names and values of the returned object records
The action uses the API V5 query API, so it follows any query data restrictions that exist for that object. For example, the HTML field for email templates can’t be returned in a query.

Objects Supported:
  • email-templates
  • custom-fields
  • custom-redirects
  • files
  • folders
  • campaigns
  • tracker-domains
Get Email TemplateRetrieves the details of an Email Template.Email TemplateBusiness Unit ID (String)
The ID of the business unit to access.

Email Template (Object)
An email template object record. Able to pass the object returned in the Get Email Template action.
Message (String)
An action success or failure message.

Is Success?(Boolean)
An action success or failure indicator.

Email Template (Object)
The email template represented by the input ID.
Copy Email TemplateCreates a new Email Template using the provided inputs.Email TemplateBusiness Unit ID (String)
The ID of the business unit to access.

Campaign ID (String - Optional)
Overrides the Campaign to use when creating the email template.

Folder ID (String - Optional)
Overrides the folder to use when creating the email template.

Tracker Domain ID (String - Optional)
Overrides the tracker domain to use when creating the email template.

Email Template (Object)
An email template object record. Able to pass the object returned in the Get Email Template action.
Message (String)
An action success or failure message.

Is Success?(Boolean)
An action success or failure indicator.

Email Template (Object)
The newly created email template.
Get Custom RedirectRetrieves the details of a Custom Redirect.Custom RedirectBusiness Unit ID (String)
The ID of the business unit to access.

Custom Redirect (String)
The ID of the Custom Redirect that you want to retrieve.
Message (String)
An action success or failure message.

Is Success? (Boolean)
An action success or failure indicator.

Custom Redirect (Object)
The Custom Redirect represented by the input ID.
Copy Custom RedirectRetrieves the details of a Custom Redirect.Custom RedirectBusiness Unit ID (String)
The ID of the business unit to access.

Campaign ID (String - Optional)
Overrides the Campaign to use when creating the Custom Redirect.

Folder ID (String - Optional)
Overrides the Folder used to use when creating the Custom Redirect.

Tracker Domain
Overrides the Tracker Domain to use when creating Custom Redirects.

Custom Redirect (Object)
The ID of the Custom Redirect object record. The name and destination URL is copied.
Message (String)
An action success or failure message.

Is Success? (Boolean)
An action success or failure indicator.

Custom Redirect (Object)
The newly created Custom Redirect.
LWCPurposeInputOutput
comboboxType ahead search with multi-select/single-select option.label: String:

required: Boolean

multiSelect: Boolean
whether the combobox is multi-select or not

messageWhenInvalid: String
Displays the given error with this message if necessary is true and the user doesn’t select the value.

options: PicklistOutput[]
selectedValue: String
Returns selected value for single-select combobox.

selectedValues: String[]
Returns a list of selected values for a multi-select combobox.
previewAssetsPreview the asset in a tabular format with given data.emailTemplates: EmailTemplateModel[]

customRedirects: CustomRedirectModel[]
Displays the assets on the flow screen.

These sections detail the unique objects provided in the API V5 for Flow toolkit.

The following is a general class to store picklist values for Account Engagement objects. A picklist output includes a display value that shows the user, and a reference ID to retrieve the record the user selects.

The email template model represents an Account Engagement Email Template.

The custom redirect model represents an Account Engagement Custom Redirect.

You can find the provided flow, Account Engagement Bulk Asset Copy, from SetupFlow. This default flow provides a moderately complex example of how a copy flow is built.

The flow just repeats the same basic pattern on multiple assets.

The steps are:

  • Determine the Business Unit to copy to and copy from
  • Select the assets to copy
  • Read the assets to copy
  • Configure the assets for copying
  • Create the copied assets

To start, pull the available Business Units and select the source and destination.

Select business units after the flow start step

Next, pull the picklist values used for the rest of the flow.

Add assets to the flow

These queries are made to prepare for selecting and configuring the assets to copy.

  • Configuration
    • Campaigns
    • Folders
    • Tracker Domains
  • Assets
    • Email Templates
    • Custom Fields
    • Custom Redirects
    • Files
    • Engagement Studio Programs

Select the assets to copy and validate to ensure a copy can occur.

Select assets to copy screen in flow

A screen presents a dropdown for each asset using a multi-select picklist, allowing for multiple options per dropdown.

If any assets are selected, the process continues to read the assets.

The following loops, repeated for each asset, pull the asset data from the source business unit.

Flow loop

The loop goes through each asset selected and reads its record from the source business unit, adding it to a new collection.

The loop repeats for each asset so that all the data for copying is available for later steps.

After all the information is read, summary information is presented to confirm the correct files are copied.

From here, configure the campaign, folder, and tracker domain to use in the destination business unit.

Configure campaign and folder in Flow

The second set of loops go through each copy request and creates the record in the destination business unit.

Copy assets in Flow

The loop cycles through the selected asset records, using the field settings as input to the copy action.

The final step records the new records ID and provides success confirmation.

Confirm copy in Flow

The same patterns apply for custom flows, only with a different set of loops to build a different bulk copy flow. With custom flows, you can also remove the loop to create copies one at a time.

Note: We recommend an understanding of the standard flow before attempting a custom flow.

Create a custom copy flow to move the right assets between business units. The standard process for a copy is to select the assets to copy, read the assets, and then create the assets using the read data.

Select an asset in an external location and copy it into Account Engagement.

Note: This use case requires an invocable action be built for the external builder service to retrieve the desired content.

After the content is received, the remainder of the flow is the same.

  1. Configure the asset.
  2. Create the asset.

Select an asset URL to embed into another piece of content.

This use case is more advanced and requires development to parse and embed the desired content. However, it’s possible to read the URL for forms, files, and custom redirects to embed them into HTML.

Flows built with API V5 for Flow can be packaged, so you can share them via AppExchange or make it easy to install into production.

The process of packaging a flow is the same as other packages. Under Salesforce Setup, go to Package Manager, and follow these steps.

  1. Create a new package
  2. Add components to the package
  3. Select the type Flow Definition
  4. Select your desired Flow Definition
  5. Upload the package
  6. Install via the provided URL