Skip to main content
Join the Agentforce Hackathon on Nov. 18-19 to compete for a $20,000 Grand Prize. Sign up now. Terms apply.
时间估计
主题
询问社区

Add a Flow as an Action on a Record

Learning Objectives

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

  • Describe use cases for adding a flow as an action.
  • Create a flow action, and add it to a page layout.
Note

We recommend completing the Screen Flows badge before working on this badge. The Screen Flows badge teaches you how to create screens in your flows.

With Lightning App Builder and Record pages, you can add flows to any record. But, remember that when you add a flow to a page, the flow runs its first screen every time the page loads. There are some situations where it makes sense to have the user decide when they’re ready to launch a flow. Here are some use cases.

Use Case

Example

The first element in the flow isn’t a screen.

The power of a flow is that it can do a lot of things behind the scenes, with the user none the wiser. But that can also make the flow a little bit dangerous, especially if it does those powerful, behind-the-scenes things before the first screen.

You built a flow that creates a task before displaying a screen to the user. If you put that flow on, say, the Account page, that flow would create a task every time a user loaded an account. That could result in lots of unnecessary tasks being created each day.

The flow isn’t used often enough to be expanded by default.

You created a flow for your office managers to order new supplies. The office managers need to be able to access that flow easily. But they don’t need to order supplies every day, so it would be a waste of space to put the flow directly on a record page.

Flow Actions

A flow action is a custom action that renders a flow, and as such it’s perfectly suited to these kinds of use cases. Once you create a flow action and add it to a page layout, it appears in the associated record’s page-level action menu where users can find it to launch the flow.

A Flow Action button in the Quick Actions bar on a record.

Similarly, a flow action can be placed in the record's action menu in the Salesforce app. Flow actions aren’t supported in Salesforce Classic.

A Flow Action button in the Salesforce app action bar.

Create a Flow Action

Let’s quickly create a flow action. We’re doing this for contacts, but you can create actions for most objects.

  1. From Setup, click the Object Manager tab. Click Contact, then click Buttons, Links, and Actions.
  2. Click New Action and set these values:
    1. For Action Type, select Flow.
    2. For Flow, select Hello World.
    3. For Label, enter Flow Action.
      The name of the action uses this label instead of the flow label.
    4. Save the action.
  3. Just like any other action, creating a flow action gets you only halfway there. Don’t forget to add it to the appropriate page layout. Otherwise, your users can never reap the benefits of your labors. The horror!
    1. From Setup, click the Object Manager tab.
    2. Click Contact, then click Page Layouts.
    3. Click Contact Layout.
    4. In the Salesforce Mobile and Lightning Experience Actions section, click override the predefined actions if present.
    5. Select Mobile & Lightning Actions in the palette, and then drag Flow Action to the Salesforce Mobile and Lightning Experience Actions section.
      Dragging the Flow Action into the Salesforce Mobile and Lightning Experience Actions section.
    6. Click Save.

Test Your Flow

Now let’s make sure everything’s working as expected.

  1. From the App Launcher (App Launcher) find and select the Sales app.
  2. Click Edge Communications.
  3. Open a contact record.
    A flow action in the contact record for Ms. Rose Gonzalez.

Notice that the page-level action menu includes Flow Action. (You may need to click the down arrow to see Flow Action.) That’s the one you created. Let’s see the flow action... in action.

  1. Click Flow Action.
    A Flow Action modal over the contact record for Ms. Rose Gonzalez. The modal’s title is Flow Action, and it’s displaying the Sample Flow flow.

The flow opens up in a separate window. Notice that the title shown isn’t the name of the flow (Hello World). The title is the label you gave the action (Flow Action). We kept the names different here to show you what’s what. When you create flow actions for your own use cases, we recommend making the action label match the flow label.

Resources

在 Salesforce 帮助中分享 Trailhead 反馈

我们很想听听您使用 Trailhead 的经验——您现在可以随时从 Salesforce 帮助网站访问新的反馈表单。

了解更多 继续分享反馈