function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
shahshah 

Extract Profile-to-Recordtype association using apex

Hi,

 

I understand that using Salesforce UI, we can associate certain record types (of an object) to a particular user profile. Once that is set, is there a way to extract that information using apex code?

 

For example:

Account object has 2 record types (Individual & Business)

Profile "Western Sales Rep" has access to only "Business" record type.

 

From Apex code, how can I identify the record types for a given profile and object?

 

Thanks. 

Best Answer chosen by Admin (Salesforce Developers) 
jeffdonthemic2jeffdonthemic2

You can access this type of information from the Metadata API but it is declarative in nature. Unfortunately it is not available via Apex.

 

Jeff Douglas

Appirio, Inc.

http://blog.jeffdouglas.com 

All Answers

jeffdonthemic2jeffdonthemic2

You can access this type of information from the Metadata API but it is declarative in nature. Unfortunately it is not available via Apex.

 

Jeff Douglas

Appirio, Inc.

http://blog.jeffdouglas.com 

This was selected as the best answer
shahshah
knicholsknichols
Could you show me how you did this?  I'm having the same problem.