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
stayal1.2953349221005618E12stayal1.2953349221005618E12 

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)
{
if(p.active)
options.add(new SelectOption(p.Value, p.Value));
}
system.debug('@@@@@@@@@'+options);

 

 

here is salesforce link that have some suggession:http://hisrinu.wordpress.com/2011/04/20/advantage-of-describe-calls/

 

any help will be appreciable