How I Solved It with Skye Tyler and Dee Ervin

One Problem, Four Solutions: Use Flow to Revive Sales Opportunities | How I Solved It

By

Welcome to a special edition episode of “How I Solved It.” In this series, we do a deep dive into a specific business problem and share how one Awesome Admin chose to solve it. But in this episode, we’ll show you how not one, not two, not three, but FOUR Awesome Admins solved the business challenge.

In this blog post, watch how two of my past “How I Solved It” stars, Skye Tyler and Dee Ervin, each tackle the same business challenge, sharing their unique solutions and guiding us through their processes to solve the business problem using Flow. To see the other two solutions to the same business problem, using Prompt Builder, check out this blog post.

Solutions covered in this post:

How Skye Tyler solved it using Flow and Data Fetcher
How Dee Ervin solved it using Screen Flows


Key business problem

Mochi, Inc. is looking for a streamlined solution for our sales team to manage and revive neglected sales opportunities.

The objective is to help our salespeople effectively re-engage with customers, advance the sales process, and offer additional products and/or services, all with personalized communication, and to allow for quick and efficient updates to these sales opportunities.

Solution 1: How Skye Tyler solved it with Flow and Data Fetcher

How I designed the solution

The first step was to make sure I had a clear understanding of how the sales team identifies their “neglected” customers, and how they would best like to complete the steps of re-engaging with them. If the solution doesn’t work for the users, it’s not a solution! During the conversations with the sales team, I discovered that the details used to identify neglected customers were primarily on the Account or Opportunity records. But they also used related Opportunity Line Items to make decisions.

Once I knew what fields to use to identify neglected customers, and how the team wanted to sort and filter results, I also needed to learn how they wanted to complete the actions necessary for re-engaging the customer. The team told me that either calling or sending an email were their preferred actions. Some additional constraints that came up were that users should only be able to see records that they own, and that Mochi, Inc. did not want the solution to include any custom code or cost additional money.

How I solved it

Go with the flow!

I’m a big fan of a good screen flow to help walk users through steps. I decided to combine Data Fetcher, a free Salesforce Labs app, with some Flow add-ons from Unofficial Salesforce* to create a reactive data table to help the sales team identify and act on neglected customers. The screen flow is embedded on the sales team’s homepage for easy and quick access. The flow starts with a screen providing initial instructions and the option to choose whether to search by accounts or opportunities (these buttons are part of the Flow Button Bar from Unofficial Salesforce).

*Note: Components from the Unofficial SF site have not gone through official Salesforce security review and are components built and shared by those in the Salesforce community. We advise you review the underlying code installed from an UnofficialSF component and make any needed changes to ensure it meets your company’s coding standards before deploying it in production.

Screen flow embedded on homepage to launch process.

The next screen is where the magic happens! Directions at the top guide users on how to filter or sort the records to find which record they want to take action on. Data Fetcher uses a Salesforce Object Query Language (SOQL) query to retrieve sets of records. The “Admin SOQL Debug” text is conditionally visible to only display for admins, which makes troubleshooting the SOQL query easier. The sort and filter options use Unofficial Salesforce Quick Choice and Slider actions, and the SOQL query automatically updates to reflect the options selected by the user. The standard DataTable is reactive and displays the results retrieved by Data Fetcher. Additional Flow Button Bar buttons give the user the ability to clear out selected sort/filter options, return to the main screen, or take action on a record that has been selected.

Screen flow with directions, sort and filter options, and table of records.

As the user makes selections in the filter or sort options, the SOQL formula updates, the Data Fetcher updates the records that it retrieves, and the Data Table displays the newly retrieved records. All this happens in a single screen, without any Get elements!

Once the user selects a record from the Data Table, additional buttons appear to allow the user to either send an email or log a call, directly within the flow. If the user is working on neglected opportunities, they’ll have the chance to update the Close Date and Stage fields within the screen flow as well. After a record has been updated, it no longer meets the criteria for “neglected” and won’t show on the list of retrieve records when the user returns.

Screen to allow inputs for creating tasks and updating Close Date and Stage on Opportunities.

Let’s build it!

Now that we’ve seen how it works, let’s see how it’s built. Here’s an overview of the entire flow.

High-level view of flow canvas.

The Re-engage Accounts screen below shows most of the elements I’ve mentioned so far. Display text components provide directions and the SOQL Debug for admins. The Flow Button Bar add-on gives you more options for navigation beyond the standard Next and Previous in the screen footer.

Flow build screen with Flow Button Bar.

The Data Fetcher component is surprisingly simple! It’s a headless component, so you can place it anywhere on the screen and users will never see it in the actual flow interface. Give it a clear name, select the object that it will be returning, and define the SOQL query. The query could be written directly in the text box, but using a formula resource is what makes it reactive to actions taken elsewhere on the screen.

Flow build screen with Data Fetcher component.

Here’s an example of the SOQL query for retrieving neglected opportunities. The first two lines are persistent and will always apply regardless of which options a users selects on the screen. The rest of the lines look at whether the user has selected a value from the sort or filter options. For example, if no option is selected for Stage, the formula displays nothing for this criteria (“”). If a Stage value is selected, the query updates to include that filter clause (“ AND StageName = ‘”+{!qc_Stage.value)+“’ ”). You can even use nested queries, such as filtering by whether the opportunity has related products or not.

Formula resource for defining the SOQL query.

And here’s the actual text of the SOQL query formula.

"SELECT Name, Amount, StageName, CloseDate FROM Opportunity WHERE OwnerId = '"+{!$User.Id}+"' AND ISCLOSED = FALSE AND CloseDate < TODAY " &
IF(ISBLANK({!slider_OpptyAmount.value}), "", " AND Amount > "+TEXT({!slider_OpptyAmount.value})+" ") &
IF(ISBLANK({!qc_Stage.value}), "", " AND StageName = '"+{!qc_Stage.value}+"' ")&
IF(ISBLANK({!qc_HasProducts.value}), "",
IF({!qc_HasProducts.value} = 'NoProduct', " AND Id NOT IN (SELECT OpportunityId FROM OpportunityLineItem)" , " AND Id IN (SELECT OpportunityId FROM OpportunityLineItem)" )) &
IF(ISBLANK({!qc_SortOppty.value}), "", " ORDER BY "+{!qc_SortOppty.value}+" ")

Skye’s business results

This solution gives the sales team a simple way to search for and identify neglected customers and opportunities, and take action to re-engage them. They are able to complete these steps quickly and efficiently whenever they have a few minutes between other activities. Keeping accounts hot and opportunities active helps Mochi, Inc. close more deals and create more add-on value for their customers.

Solution 2: How Dee Ervin solved it using screen flows

How I designed the solution

I designed a solution by first identifying the business requirements essential to addressing the challenge. After defining these needs, I mapped out a design prioritizing user experience, easy maintenance, and scalability. For user experience, I ensured that all key information would be brought forward in one view, minimizing navigation and keeping users on their current screen to maintain focus. In terms of maintenance, the solution emphasizes declarative tools over custom code and is designed to be easily distributed across objects.

From a scalability perspective, the solution is adaptable to support more complex workflows and is repeatable for other objects and teams as the organization’s needs grow. As a result, I created a Screen Flow component specifically for neglected opportunities, which dynamically displays records based on the logged-in user. By placing this component on frequently accessed objects in the sales workflow, I help users take quick action on one or multiple records directly within the component, streamlining their work processes.

How I solved it

Create a new text field and a custom permission

First, I created a text field on the Opportunity record to capture a personalized message for each follow-up email. This will serve as a quick reference to the last message, with the historical values being captured in the logged email messages.

  1. Field: Follow-up Message
    • Data Type: Long Text Area (5,000)
    • Description: Last personalized message sent via neglected sales opportunities flow.
    • Additional Note: This message will appear within the screen flow for editing and replacement.

Opportunity custom field screen within the Setup UI.

Next, I created a custom permission to assign to users who should have access to the new Screen Flow component when placed on the Lightning record page. A custom permission lets you define access checks to your apps or processes. Custom permissions can be assigned to users via permission sets or profiles, similar to how you assign user permissions and other access settings.

  1. Custom Permission: Sales
    • Description: For Sales access to current closing Opportunities (via Flow component)

Custom Permission Detail page within the Setup UI.

Create a screen flow

I created a screen flow that is record ID agnostic. Since the Flow component should be able to be placed on any Lightning page, passing the record ID value is not necessary.

Flow canvas with a zoomed-in version of the first half of the flow.

Complete flow.

1. Start with a Decision element to ensure the logged-in user has been assigned the Sales custom permission.

Decision element to check that the Sales custom permission is assigned to the logged-in user.

2. Query for neglected opportunities based on criteria discussed with stakeholders using a Get Records element.

  • Get all neglected opportunities and sort by one of the key fields.

Get Records element to query for all neglected opportunities.

3. Create a Screen element to render the neglected opportunities owned by the logged-in user and aligned with the criteria set by stakeholders.

  • Add a Data Table component to list the neglected opportunities.
  • Reference the collection variable created from the Get Records query.
  • Configure which columns should be shown in the table.
  • Set the Data Table to allow for multiple selections.

Screen element with a Data Table component and configuration panel to the right.

4. Add a Loop element to loop over the neglected opportunities in the collection variable to update the opportunities and send a personalized email to each related contact.

Loop element with a Collection Variable assigned with the records selected in the Data Table.

5. Create a Screen element to render each neglected opportunity.

  • Add key opportunity fields for update (that is, Stage, Follow-up Message, and Next Step).
  • For the Follow-up Message recipient (that is, Related Contacts), add a Contact Lookup component to allow users to select a related contact from a list.
    • Create a Record Collection Choice Set to support this component.
    • Create additional Variable resources as needed to save data from selections to use later in the flow (that is, Email, etc.).

Screen element with variables for Stage, Related Contact, Follow-up Message, and Next Step, and configuration panel to the right.

6. Configure the Send Email Action to send an email to the contact selected with the Follow-up Message merged into the body. You can do this by creating a Text Template resource within the flow.

  • Enable Use Line Breaks and Rich-Text-Formatted Body to apply limited formatting to the Follow-up Message text area for readability.
  • Ensure the logged-in user has a signature set up that can be merged into the Text Template resource.
  • Enable Log Email on Send for activities tracking.

Send Email action screen with the description, “Action to send email to selected Contact”.

7. When the Loop completes, the final step is to update the opportunities collection with the changes made within the flow screens using an Update Records element.

Update Records element with a collection variable assigned with the opportunity records from the Loop element.

8. The final step is to add the Flow component to the desired Lightning pages.

Opportunity record with Flow Screen component under the Sales Path near the top of the page showing the neglected opportunities, and three selected for actions.

Opportunity record with Flow Screen component under the Sales Path near the top of the page showing the screen to edit each opportunity selected in the previous screen.

Dee’s business results

  1. The Mochi, Inc. sales team is able to take action on neglected opportunities anywhere in Salesforce.
  2. Admins can continue to iterate on the foundation by adding other pertinent fields to screens, product recommendations, or other useful data.
  3. Sales managers will know that their teams are consistently pushed opportunities to ensure records are no longer neglected.

Do try this at home

Skye’s tips

Both Data Fetcher and Unofficial Salesforce add-ons can be installed in a developer environment. Try adding different filter or sort options and see how flexible this solution can be!

Dee’s tips

  1. Try building more helpful components into the screen to help the team.
  2. Try adapting this solution for other teams and use cases.

Resources

Want to see more good stuff? Subscribe to our channel!

SUBSCRIBE TODAY