Search code examples
salesforceapex-code

how to determine which profiles are assigned to a record type


I have 90 profiles,and a bunch of record types. Business wants to know who has access to a current record type (picklists..)

the only way i know how to do this, is to go profile by profile and check the Record Type Settings and see if it's listed.

is there a way to just generate a list or something? either through the point and click or apex?

EDIT:

I tried doing a search on the .profiles but eclipse doesn't support multi-line searches. Though it does support regexes i can't get my regular expression right, OR eclipse doesn't like me. Given my poor programming skills (and how I yell at my computer) it might be the latter. This is the string I want to search on.

<recordType>Event.RTEvent</recordType>
    <visible>false</visible>

Solution

  • For something like this, I find that Notepad++ is a huge help. It supports multi-line searches if you enable the extended search mode (a simple radio button at the bottom of the Find menu), allowing you to grab line breaks (\r, \n, etc.). Pretty simple to do this across all of your profiles as well by navigating to the profiles folder of the Eclipse project in Windows Explorer, selecting all files, then right-click and select "Edit with Notepad++". Once they're all open, hit ctrl-F, enable the extended search mode, and search for something like this:

    Event.RTEvent</recordType>\n        <visible>false
    

    Note that you may need to adjust the number of spaces after the \n depending on how far the data is indented. Click "Find All in All Opened Documents", and it'll give you a list of all occurrences of that string in your profiles files.