In general, Apex help to get all the picklist field values regardless of record type of on sObject, but the values can be retrieved using the schema class.
The below snippet is used to retrieve all the picklist values from the sObject.
Alternatively, the following two ways can read the picklist values based on the record type of the sObject.
- sforce.connection.describeLayout
- MetadataService
sforce.connection.describeLayout
The describeLayout() call returns the top-level record type information passed-in sObjectType through the DescribeLayoutResult. Each DescribeLayout is referenced by its unique layout ID.
var result = sforce.connection.describeLayout(<object Name>);
If sObject has record type, recordTypeSelectorRequired displays as ‘true’. Otherwise, it will be false.
MetadataService
The MetadataService offers the browser based user interface for the Force.com applications. It allows the users to create, update, delete and retrieve records, including the customization information and its processing also.
Use the below link to proceed the installation process.
Sample code: