Skip to main content
Build the future with Agentforce at TDX in San Francisco or on Salesforce+ on March 5–6. Register now.

Use Automation Components in Flow Builder

Follow Along with Trail Together

Want to follow along with an expert as you work through this step? Take a look at this video, part of the Trail Together series.

(This clip starts at the 7:03 minute mark, in case you want to rewind and watch the beginning of the step again.)

Introduction

Ready to put your skills to the test and implement an automation component? Let’s build a flow that puts into practice what you've learned and set up so far.

Build a Flow to Lock Closed Lost Opportunities

The Universal Containers team wants to lock opportunities that have been set to Closed Lost so users don’t modify the opportunities. To achieve this, they can use a Record-Triggered Flow to evaluate changes on an opportunity. If the Opportunity Stage has been set to Closed Lost, they can use the Record Lock invocable action from the Automation Components Sample Application to lock the record.

Enable Record Locking in Apex

  1. In your Trailhead Playground, from Setup, enter Process Automation Settings in the Quick Find box and select Process Automation Settings.
  2. In Default Workflow User, click the lookup icon and select your name.
  3. Select Enable record locking and unlocking in Apex.
  4. Click Save.

Create a Flow

  1. From Setup, enter Flows in the Quick Find box and select Flows.
  2. Click New Flow.
  3. Make sure Start from Scratch is selected, and click Next.
  4. Select Record-Triggered Flow and click Create.

Set the Trigger Criteria

Select the event (trigger) and object that cause the flow to run.. 

  1. Search for the Opportunity object and select it.
  2. Change the Trigger the Flow When selection to A record is updated.
  3. In the button bar, change the Auto-Layout setting to Free-Form.

Filter with a Decision Element

Filter out opportunities that have not been Closed Lost in the flow so that we only update the correct records. 

  1. From the Elements tab in the toolbox, drag Decision onto the canvas.
  2. In the New Decision window, enter these values.
    1. Label: Opportunity Closed Lost?
    2. API Name: Opportunity_Closed_Lost
  1. Make sure that New Outcome is selected, and enter these values into the Outcome Details section.
    1. Label: Closed Lost
    2. API Name: Closed_Lost
    3. Select All Conditions Are Met (AND).
  1. For Resource, enter these conditions.
    1. Resource: select Triggering Opportunity, then select Stage
    2. Operator: Equals
    3. Value: Closed Lost
  1. For When to Execute Outcome, select  If the condition requirements are met.
  2. Click Done.

Add the Action

Use the Lock Record action from the Automation Components Sample Application inside the Flow Builder.

  1. From the toolbox, drag the Action element onto the canvas.
  2. Select the Security category.
  3. Click in the search box.
  4. Select Locks or unlocks a record.
    1. Flow Label: Lock Record
    2. Flow API Name: Lock_Record
  1. For recordId, select Triggering Opportunity, then select Opportunity ID.
  2. Under Set Input Values, for isLocked:
    1. Move the Don’t Include slider to Include.
    2. Select True
  1. Click Done.

Connect the Elements to Finish the Flow

Connecting the flow elements tells the flow what order to follow at runtime.

  1. At the bottom of Start, select the node and drag it to the Opportunity Closed Lost? Decision.
  2. At the bottom of the Opportunity Closed Lost? Decision, select the node and drag it to the Lock Record Action.
    1. For the outcome, select Closed Lost.
    2. Select Done.
  1. Click Save.
    1. Label: Lock Opportunity Record
    2. API Name: Lock_Opportunity_Record
  1. Click Save.
  2. Click Activate.
  3. Click Back.

Flow Navigation Bar

Update an Opportunity

Let’s check that our flow is running by updating an Opportunity Stage to Closed Lost.

  1. Open the App Launcher and select the Sales app.
  2. In the search bar, type University of AZ Installations and select it.
  3. Select Closed in the opportunity path and select Select Closed Stage.
    1. Update the Stage to Closed Lost.
    2. Click Save.
  1. The opportunity is now locked. As an admin, you are still able to edit the record, but your users are no longer able to edit.

What’s Next?

While this is the end of your introduction to the Automation Components app, there’s more to explore. Feel free to take a look at the other components and get hands on with them in Flow Builder. 

You can also check out the other sample apps in the Trailhead Sample Gallery. Here, you can complete projects, explore source code, and continue to grow your skills.

Partagez vos commentaires sur Trailhead dans l'aide Salesforce.

Nous aimerions connaître votre expérience avec Trailhead. Vous pouvez désormais accéder au nouveau formulaire de commentaires à tout moment depuis le site d'aide Salesforce.

En savoir plus Continuer à partager vos commentaires