0

Lets assume there is a custom profile "Profile_A", a custom object "My_Object" and there are several record types for that object. I have to find out whole bunch of things, but it boils down to following two queries-

Task1 - What record types of a My_Object are available to Profile_A?

Lets say, we get several record types - RT_1_My_Object , RT_2_My_Object, RT_3_My_Object as a result

Task 2 - What profiles have access to record type RT_1_My_Object ?

How do i perform above two queries. I cant seem to understand the data model. What relates profiles, record types, objects?

I am trying to look at fields of profile object, record type object, but cant understand the relation. Schema builder isn't helping either.

I am 100% sure we are looking at junction objects. But i cant filter it down. Any help or guidanc ewill be appreciated

  • Once you have the answer to those questions, what do you need to do with it? Record types are essentially a declarative way to have a different view based on some rule (users with this profile see this layout for this record type) and/or filter picklists. The question makes me wonder if you're trying to use them in some way they weren't ever intended. – pchittum Oct 22 '15 at 21:57
0

Object permissions and Record Types are tied to the Profile. For each profile you can click on it and scroll down to Custom Object Permissions to see what access the profile has to the object. There is also a Record Type section that will list each object and the record types available for that profile on the object. Hopefully that makes sense.

| improve this answer | |
  • Blair - I know how to do it via user interface. I need to find out how to query it. In practice, i have whole bunch of profiles and objects to take into account. There is no way it can be done via UI. I cant go to each profile and see what record types are available to them – user21352 Oct 22 '15 at 20:47
  • OK, you may want to try this link salesforce.stackexchange.com/questions/4377/… There were some answers there that may be helpful. – Blair Kristin Oct 22 '15 at 21:20
0

You can't directly query either of those two relations directly. You can easily determine which record types a user has access to by using RecordTypeInfo. You can simply write code like this:

for(RecordTypeInfo info:
    Account.SObjectType.getDescribe().getRecordTypeInfos()) {
    if(info.isAvailable()) {
        // User can use this record type
    }
}

To get the answer to your second question, you'd have to use the metadata API to retrieve all profiles, read the XML files, and determine which profiles have access to the record type. There's literally not even a way to get all profiles that can use a record type in the UI that I'm aware of.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.