Create an Automation with Flow | 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.
- From Setup, select the Object Manager tab.
- Click Opportunity from the table of objects, then press ENTER on the Fields & Relationships tab.
- At the top of the Fields & Relationships section, activate the New Custom Field button .
- Select Checkbox as the data type, and activate the Next button.
- Complete the new field details in Step 2:
Field |
Value |
Field Label |
First Contact Made |
Default Value |
unchecked |
Field Name |
[this field auto-populates] |
- Activate the Next button, then complete Step 3.
- In the Read-Only column header, select the checkbox.
- In the Read-Only column, deselect the Standard User and System Administrator checkboxes.
- Activate the Next button, then the Save & New button.
Now add an Additional Meeting Scheduled field to the Opportunity object:
- Select Checkbox as the data type, and activate the Next button.
- Complete the new field details in Step 2:
Field |
Value |
Field Label |
Additional Meeting Scheduled |
Default Value |
Unchecked |
Field Name |
[this field auto-populates] |
- Activate the Next button, then complete Step 3.
- In the Read-Only column header, select the checkbox.
- In the Read-Only column, deselect the Standard User and System Administrator checkboxes.
- Activate the Next button, then the Save button.
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.
- From Setup, enter Flows into the search field at the top of the page and select the result for Flows | Object | Process Automation.
- Activate the New Flow button.
- Select the radio button for Record-Triggered Flow and activate the Next button.
Next, choose the opportunity object and the trigger.
- In the Select Object combo box, choose Opportunity.
- From the Configure Trigger section, choose the radio button for A record is created or updated.
- In the Conditions Required combo box, select All Conditions Are Met (AND).
- Fill in the criteria.
Field |
Operator |
Value |
StageName |
Equals |
Prospecting |
- in the grouping for When to Run the Flow for Updated Records, choose the radio button for Every time a record is updated and meets the condition requirements.
- in the Optimize the Flow section, ensure the radio button for Actions and Related Records is selected.
- Activate the Done button.
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.
- Press ENTER on the Add Element button in the canvas area, then choose Update Records from the menu.
- For the label, enter Opportunity Stage Update.
- TAB into the API Name text box to generate an automated API name.
- Select the radio button for Use the Opportunity record that triggered the flow.
- In the Condition Requirements to Update Record combo box, select All Conditions Are Met (AND).
- Activate the Add Condition button and fill in the criteria under the Set Filter Conditions heading.
Field |
Operator |
Value |
First_Contact_Made__c |
Equals |
{!$GlobalConstant.True} |
Additional_Meeting_Scheduled__c |
Equals |
{!$GlobalConstant.True} |
- Under the Set Field Values for the Opportunity Record heading, fill in the criteria.
Field |
Value |
StageName |
Qualification |
- Activate the Done button.
Save and activate the flow.
- Activate the Save button.
- For Flow Label, enter Opportunity Stage to Qualification.
- TAB into the API Name text box to generate an automated API name.
- In Description, enter: Update the opportunity stage to Qualification when all tasks for the Prospecting stage are complete.
- Activate the Save button.
- Press ENTER on the Activate button.
Test the Flow
- At the top of the page, activate the back link to return to setup.
- Activate the App Launcher button and search for Sales.
- In the navigation menu, activate the Opportunities link.
- Activate the Select List View button , then select All Opportunities from the menu.
- From the table of records, select the Pyramid Emergency Generators opportunity.
- Under the first Tabs heading, press ENTER on the Details tab to view the associated fields to this record.
- Note that the current stage is Prospecting.
- Click the Edit button next to First Contact Made field.
- Check the boxes for the First Contact Made field and the Additional Meeting Scheduled field.
- Activate the Save button.
- 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.
Click to return to the unit on Trailhead to verify this step.