+ Start a Discussion
asadim2asadim2 

RecordTypes still not working in version 20

Hi,

 

According to the following page Record Types should be supported in VF on version 20:

http://www.salesforce.com/us/developer/docs/pages/Content/pages_intro_whats_new.htm

 

Well, I have a VF page for MyObject__c with a picklist on it, and there's a Record Type against MyObject__c which filters the values in that picklist. When I open the page instead of seeing only the filtered picklist values all the values are displayed. This Record Type is set against the Sys Admin Profile and I am logged in with a User in that same profile. Btw both the VF page and its controller are on version 20 of the API.

 

Any ideas what could be the problem? Thanks!

Best Answer chosen by Admin (Salesforce Developers) 
asadim2asadim2

A few things I'd check:

1) your VF page and the controller are on version 20 of the API

2) the query is actually returning something

3) the RecordType your query is returning has the correct picklist filter on it -i.e. make sure that it's not loading some RecordType with all picklists available in it

 

All Answers

BomanBoman

This feature (introduced in Winter'11) does not seem to work!! I too have a picklist with values determined by recordType, but in my VF page ALL select options always show up for the picklist, no matter what the recordType (the object of concern is a Case).

 

Any ideas?

asadim2asadim2

Turns out you need to set the Record Type for the record that you've built the VF page for inside your controller before loading the page.

BomanBoman

Thanks, but what precisely do you mean? I am already doing this in the constructor of my BillingCaseController:

 

//Set Record Type

billCase.RecordTypeId = [SELECT Id FROM RecordType WHERE SObjectType = 'Case' AND Name = 'Billing' LIMIT 1].Id;

 

But has no effect! I still see ALL picklist options and not solely those for "Billing".

 

--Boman.

asadim2asadim2

A few things I'd check:

1) your VF page and the controller are on version 20 of the API

2) the query is actually returning something

3) the RecordType your query is returning has the correct picklist filter on it -i.e. make sure that it's not loading some RecordType with all picklists available in it

 

This was selected as the best answer
BomanBoman

Version 20.0 did the trick (set that for both, the Controller and the VF Page). Thanks!