Skip to content

Capture the record visitor details using Screen Flow

DESCRIPTION:

You want to record the data for the visitors that visit the Salesforce record pages. We can easily achieve this using screen flow with a few simple steps.

SOLUTION:

  • Create a custom object “Record Visitor” with the following fields.
    • Object Name (text)
    • Record Id (text)
    • User (Lookup to user object)
  • Create a Screen Flow “Hidden Screen for Visitor Count” 
  • Create a new input variable “recordId“.
  • Create a formula variable to get the record type prefix using the record id. 
  • Add a Get element to get the Entity Definition record using the prefix formula. We’re using this just to get to the object name.
    • We can also pass the object name in the variable along with “recordId” variable while adding the flow to the lightning record page. 
  • Create a Record Visitor record by setting the User Id, Record Id, and Object Name.
  • Add a blank screen at the end and you’re done. Activate the flow. 

See how the complete flow looks like now

Add this screen flow on the lightning record detail page for the object you want to start tracking.

Please see the following for what our ghost screen looks like.

You’ll see all tracking records in the custom object but if you want to see it on the record level then you can create an LWC component to show it on the record level.