While working with business owners, I found that they want to learn more about how opportunities are moving towards closure and how other reps use the opportunity. Such information helps business leaders improve rep onboarding, planning, and more.
Salesforce provides many ways to track field changes, stage history, etc. In this article, we will learn how you can use Salesforce flow to track who viewed an opportunity – similar concepts you can apply to any other object.
Use Case
Carol Brook, a VP of Sales at Appiuss Inc. At Appiuss opportunity, OWD is open, so sales representatives can view each other’s opportunities. Carol comes up with a few ideas to better understand how they use others’ opportunities to close their deal.
- Implement automation that helps sales leadership to understand how many times Sales reps view an opportunity except the owner.
- Then she wants to implement a heat map to understand better which part of the opportunities sales reps is looking at.
In this article, we will implement the first use case. Let’s get started:
There are 3 steps to solve the above business requirement.
- Create a custom object to store the number of views of an opportunity.
- Create a screen flow.
- Add screen flow to the record page.
Step1: Create a custom object
- Go to Set Up | Object Manager | Create | Custom Object.
- Create a custom object with the name Opportunity View.
- Create Tab for Opportunity View object.
- Create the below fields in the newly created custom object.

- Assign Opportunity View custom object permissions to the profiles.
Step2: Create Screen Flow
- Click Setup | In the Quick Find box, type Flows.
- Select Flows | Click on the New Flow.
- Select the Screen Flow | Click on Create (It will open a flow designer for you).
- Select Toolbox | Manager | Click on New Resource.
- Create a Text Variable named: recordId.




- On Flow Designer, click on the +icon and select the Get Records element.
- Enter the Label: getOpportunity, API name will auto-populate.
- Select All Conditions Are Met (And) and (Define condition shown in the below screenshot).




- Click on the +icon and select the Decision element | named it LoggedIn User is Owner.
- In Outcome Order No |
- Select Condition Requirements to Execute Outcome: Custom condition Logic Is Met
- Write the condition logic shown in the screenshot below.




- Click Done.
- Under the Outcome node No | Click on the +icon and select the Get Records element.
- Enter Lable: getOpptyView, API name will auto-populate.
- Select All Conditions Are Met (And) and (Define condition shown in the below screenshot).




- Click Done.
- Click on the +icon and select the Decision element | named it View Record Found?
- In Outcome Order Yes |
- Select Condition Requirements to Execute Outcome: All Conditions Are Met (AND).
- Write the condition logic shown in the screenshot below.




- Click Done.
- Under the Outcome node No | Click on the +icon and select the Create Records element.
- Enter Lable: Create View, API name will auto-populate.
- Select Object: Opportunity View and Set Field Values for the Opportunity View, as shown in the screenshot below.




- Click Done.
- To count the number of views, Create a formula.
- Select Toolbox | Manager | Click on New Resource
- Create a number type Formula named: forN_Count
- Formula
:{!getOpptyView_0.Number_of_Views__c}+1
- Formula




- Click Done.
- Under the Outcome Node Yes | Click on the +icon and select the Update Records element.
- Enter Lable: Update View Count; API name will auto-populate.
- Select Object: Opportunity View
- Select Condition Requirements to Execute Outcome: All Conditions Are Met (AND)
Id Equals {!getOpptyView.Id}
- Set Field Values for the Opportunity View, as shown in the screenshot below.




- Click Done.
- Add Screen element and name it Blank.
- Hide Header and Footer in the screen element properties.
Finally, the screen flow looks like this:




Step3: Add flow to the record page
Check out this video for step-by-step instructions
Let’s verify this.
I hope you find this article helpful. I would love to hear from you! Share your tips in the comments!