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

Picklist values based on recordtype

Below is the scenario where i'm stuk.


I want to get picklist values based on recordtype for a object (account) but i'm not able to get it .

below is some code through which i have tried to get that.


RecordType rttt = [SELECT Id,Name FROM RecordType WHERE SobjectType='Account' and name='newrecformanaged'];

List<SelectOption> options = new List<SelectOption>();
Schema.DescribeFieldResult fieldResult = account.rttt.Type.getDescribe();
List<Schema.PicklistEntry> ple = fieldResult.picklistValues;
for(Schema.PicklistEntry p : ple)
options.add(new SelectOption(p.Value, p.Value));



here is salesforce link that have some suggession:


any help will be appreciable