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
oldtownoldtown 

RecordType not having any effect on picklists

<apex:page cache="false" expires="1" controller="PerfRevMyMgrReview" showHeader="false" standardStylesheets="true">

<apex:composition template="{!$Site.Template}"><

apex:define name="body">

<apex:form ><

font size="3">

<apex:pageBlock title="Business Goals" mode="edit"></font>

<table cellspacing="0" cellpadding="0" width="100%" border="0">

<tr><td>

<apex:outputLabel value="Increase Student Success:" for="BusinessGoals1"/>

</td><td> 

<apex:inputField value="{!PR.BusinessGoals1__c}" id="BusinessGoals1"/></

td></tr>

 </table>

 </apex:form>

</apex:define>

</apex:composition>

 

</apex:page>

 

public with sharing class PerfRevMyMgrReview {

 

public PerfRevMyMgrReview() {

PageReference pageRef = System.currentPageReference();

RecordType r = [select Id from RecordType where name='MidYearManager'];

PR =

new PerformanceReview__c(RecordTypeId=r.id);

}

private PerformanceReview__c PR;

public void setPR(PerformanceReview__c v){

PR=v;

}

public PerformanceReview__c getPR(){

return PR;

}

 

}.

 

PR is a custom Object with several recordtypes defined

BusinessGoals1__c is a pick list which is filtered by record type

if I create a new PR in Salesforce it asks me to select the recordtype, doing so then shows the correct filtered pick list contents.

When I use a force.com custom page and a custom controller. it doesn't filter the pick list.

I an setting the recordtype when I create a new instance and doing so in the constructor of the custom class.

this all compiles aned deploys fine, works ok except for the extra elements in the pick list.

I can remove them using javascript but this seems like a poor solution.

I have tried using a standardcontroller and setting the recordtype in the constructor also which produced the same result.

 

Anyone else run into this and did you find a solution?

thanks

in advance

Best Answer chosen by Admin (Salesforce Developers) 
Cool_DevloperCool_Devloper

This is a known issue my friend:(

RecordTypes do not work with VF pages!

You need to do the filtering yourself using a custom object or within the code itself using some reRendering on the page!!

you can support this on Ideas i guess;)

Cool_D

All Answers

Cool_DevloperCool_Devloper

This is a known issue my friend:(

RecordTypes do not work with VF pages!

You need to do the filtering yourself using a custom object or within the code itself using some reRendering on the page!!

you can support this on Ideas i guess;)

Cool_D

This was selected as the best answer
oldtownoldtown
Thanks, that's what it looked like but I couldn't come up with any confirmation. A little js will fix my particuylar issue.