How to create Salesforce record list view where logged in user = created by user?

I’ve run into this issue a few times in creating list views for self-service communities: A Community user wants to monitor cases they’ve created & rules exist to assign ownership of cases to a queue instead. Out of the box, Salesforce list views offer the filter of “My Cases”, but this only shows cases where the logged in user is the case owner. Oftentimes, the requirement calls for the owner to be assigned to a queue, so the list view can’t utilize the “My Cases” filter. What to do?

The easiest way to work around this is to create a formula field of type checkbox on the Case object (in my example, labeled “Logged In Users Case”), and apply the following formula:

IF( CreatedBy.Id = $User.Id, TRUE, FALSE)

Once that is complete, view your Cases in the org and create a new list view, visible to all users (to make it visible in a community). Since this will be visible to your community users, make sure to name it something appropriate, as they could see the name, depending on how you set up the Record List component.

Then edit the filter, changing “Show me” to All Cases, and add a field filter, calling up your new formula field and setting the value to “true”.

This essentially says, take all the cases, and when the logged in user ID is equal to the Created by ID of the Case record, show it in this list. You can then go in and apply this list view in your community to your users.

Have you run across another way of doing this? I’d love to hear it!


Leave a Reply

Your email address will not be published. Required fields are marked *