Skip to main content

Create an Automation with Flow

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 59:50 minute mark, in case you want to rewind and watch the beginning of the step again.)

Note

Accessibility

This step requires some additional instructions for screen reader users. To access a detailed screen reader version of this step, click the link below:

Open Trailhead screen reader instructions.

Introduction

Creating a flow—such as automatically changing the value of a field to a value you specify based on certain criteria, as we do here—is another way to prevent data from getting messy. Depending on the type of field, you can apply a specific value, make the value blank, or calculate a value, all based on a criteria you set. Use automation to improve data quality by reducing manual data entry and keeping data in sync.

Set Up Automated Updates

You’ve gotten another task from the AW Computing VP of sales Allison Wheeler. She requested that the Opportunity stage automatically updates to Qualification when all tasks for the Prospecting stage are complete. You can take care of this by creating a flow in Flow Builder. But first there’s a little prep work. Much like you add containers to your pantry to keep items organized, you can add custom fields to objects to keep data organized.

First, add a First Contact Made field to the Opportunity object.

  1. From Setup, click the Object Manager tab.
  2. Click Opportunity, then click Fields & Relationships.
  3. At the top of the Fields & Relationships section, click New.
  4. Select the Checkbox radio button, and click Next.
  5. Enter these field details.
    • Field Label: First Contact Made
    • Default Value: unchecked
    • Field Name: [this field auto-populates]
  6. Click Next.
  7. In the Read-Only column header, select the checkbox.
  8. In the Read-Only column, deselect the Standard User and System Administrator checkboxes.
  9. Click Next, then click Save & New.

Now add an Additional Meeting Scheduled field to the Opportunity object:

  1. Select the Checkbox radio button, and click Next.
  2. Enter these field details.
    • Field Label: Additional Meeting Scheduled
    • Default Value: unchecked
    • Field Name: [this field auto-populates]
  3. Click Next.
  4. In the Read-Only column header, select the checkbox.
  5. In the Read-Only column, deselect the Standard User and System Administrator checkboxes.
  6. Click Next, then click Save.

Now the sales team can use these newly created fields to keep better track of their opportunity stages, and you can use the fields in a flow.

Start by choosing the type of flow. 

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

Next, choose the opportunity object and the trigger.

  1. In the Select Object section, enter opportunity and select Opportunity.
  2. In the Configure Trigger section, select A record is created or updated.
  3. In the Set Entry Conditions section, select All Conditions Are Met (AND).
  4. Fill in the criteria.
    • Field: StageName
    • Operator: Equals
    • Value: Prospecting
  5. In the When to Run the Flow for Updated Records section, select Every time a record is updated and meets the condition requirements.
  6. In the Optimize the Flow section, select Fast Field Updates.

Now add an action to the flow you’re creating to ensure the Opportunity stage is only updated to Qualification when both First Contact Made and Additional Meeting scheduled are both checked.

  1. On the flow canvas, on the path after the Start element, click Add Element.
  2. Select Update Records.
  3. For Label, enter Opportunity Stage Update.
  4. Click in the API Name text box to generate an automated API name.
  5. Select Use the Opportunity record that triggered the flow.
  6. In the Set Filter Conditions section, select All Conditions Are Met (AND).
  7. Click + Add Condition and fill in the criteria.
    • Field 1: First_Contact_Made__c
    • Operator 1: Equals
    • Value 1: $GlobalConstant.True
    • Field 2: Additional_Meeting_Scheduled__c
    • Operator 2: Equals
    • Value 2: $GlobalConstant.True
  8. Under Set Field Values for the Opportunity Record, fill in the criteria.
    • Field: StageName
    • Value: Qualification

Save and activate the flow.

  1. Click Save.
  2. For Flow Label, enter Opportunity Stage to Qualification.
  3. Click in the API Name text box to generate an automated API name.
  4. In Description, enter: Update the opportunity stage to Qualification when all tasks for the Prospecting stage are complete.
  5. Click Save.
  6. Click Activate.

Test the Flow

  1. Click the back arrow back arrow to return to setup.
  2. Click the App Launcher App Launcher icon and select Sales.
  3. Click the Opportunities tab.
  4. Click the down arrow next to Recently Viewed opportunities, then select All Opportunities from the list view.
  5. Open the Pyramid Emergency Generators opportunity.
  6. Click Details to view the associated fields to this record.
  7. Note that the current stage is Prospecting.
  8. Click the pencil icon next to First Contact Made field.
  9. Add checks to First Contact Made and Additional Meeting Scheduled.
  10. Click Save.
  11. Note that the current stage is now Qualification. The flow worked as anticipated!

Put away your virtual broom and data dustpan, and peel off those rubber gloves—you’re done with the dirty work! Using validation rules, formula fields, lookup filters, and a flow to enforce data quality, you’re preventing the buildup of schmutz, and AW Computing is on its way to an org full of simply sparkling data.

Share your Trailhead feedback over on Salesforce Help.

We'd love to hear about your experience with Trailhead - you can now access the new feedback form anytime from the Salesforce Help site.

Learn More Continue to Share Feedback