+ Start a Discussion
nandurinanduri 

How to find list of RecordTypes that are available to a User or User's Profile via APEX or SOQL

Hi, I am trying to find the available RecordTypes for a User or User's Profile from my APEX class. Any idea how can this be done?

AmitSahuAmitSahu
I need this info. Please let me know if you could get this resolved.
craigmhcraigmh

I was going to suggest using the UserRecordAccess SObject, but that looks like it won't work, with my testing.

 

You could also use an aggregate query if it's only for a specific SObject, but that limits you to only testing over 10k records:

 

Select RecordTypeId, Count(Id) From Account Group By RecordTypeId Limit 10000

 

AmitSahuAmitSahu
Thanks for the reply. I created a workaround for this. It seems the apex code can only say if you have access to a record type based on logged in user profile. But if I will invoke the same code in the background that will be run under system mode. So I created a custom setting and stored the accessible record types in there along with the profile id..it works that way ....