I was curious if anyone knows of a way to search the entire Salesforce org to see where a user (id and/or full name) is referenced (i.e., leads, contacts, accounts, workflow rules, process builders, flows, etc...)? I am asking because I would like to create an automation that when a user is replaced by another user, I can see all the places the previous user is referenced and change it to the new user.

Any help would be greatly appreciated. Thank you!

  • Having explicit references to users (or profiles etc.) is an anti-pattern. Instead, use custom permissions and test for the user having the permission (or not) where you would have tested for the user (or profile) directly. This has two advantages: 1. it is portable between orgs and 2. you can control the behaviour by assigning the custom permission in a perm set or profile which is assigned to any number of users.
    – Phil W
    Nov 19, 2021 at 7:17
  • 1
    If you retrieve all the metadata from the org using sfdx force:source:pull you can then run a search for the user ID or Name across the retrieved metadata.
    – Phil W
    Nov 19, 2021 at 7:19
  • @PhilW I completely agree with this being an anti-pattern....it is legacy work from the previous administrator. However, until I make changes to the entire system (scheduled for completion mid-2022) I have to work around the spider web of previous admins work. The biggest concern is the sharing rules and workflow rules and such....I need to be able to quickly locate where the users reference is to make those changes quickly. I have IntelliJ installed with Illuminated Cloud, could you provide some more detail on sfdx force:source:pull? Is that a command line string I can run in IntelliJ?
    – PowerUp
    Nov 22, 2021 at 16:53
  • IDEA+IC2 gives you access to using the CLI tools, if you also install sfdx, through the toolbar (pull) or you can ask IC2 to retrieve all metadata (if you don't use sfdx) via standard Metadata/Tooling API (select unsubscribed/server only in the retrieve window) then once retrieved just search in files for the required name/ID. You could update the files then deploy (changed files) back to the org. You clearly need to make sure you have already set up a connection before you try this. Read the IC2 documentation if any of these steps are unclear.
    – Phil W
    Nov 22, 2021 at 16:58
  • @PhilW I am using IntelliJ with Illuminated Cloud and I was able to retrieve the metadata...however, any user I try and search for doesn't come up with any results. Am I doing something wrong searching or do you know if there is a specific area in the retrieved metadata I need to search in? Any help would be greatly appreciated.
    – PowerUp
    Jul 7, 2022 at 6:19


You must log in to answer this question.

Browse other questions tagged .