+ Start a Discussion
SwapnaSwapna 

Display Picklists specific to recordtype on a visualforce page

HI All

 

I'm trying to display picklist values specific to a recordtype.

I have a visual force page which uses standard controller and an extension.


We are assigning the recordtype based on specific criteria with in the constructor.

http://developer.force.com/releases/release/Winter11/Visualforce+Support+for+Record+Types

As per the documentation, by using inputfield and version 20. I should be able to achieve what im trying to do.

But it is not working..

 

Im sure there is something wrong with my method.

 

Any pointers will be great help.

 

Thanks

Swapna

 

BibhuBibhu

Hi 

I also have the same problem . I have a custom object with different record types. I am over-riding new button on the object . Depending on User Profile I am redirecting the User to VF page . User has an option to select the record type while clickin on new button but the problem is picklist value is displayed irrespective of the record type selected . Picklist value is always selected for the record type marked as deault in User's profile.

 

If you got the solution to your problem then kindly share it , It would really be great help . MY VF page Version num is 25.0 .

Here is the code for New Button and Controller class

 

 

VF PAGE for Overriding New Button

 

 

<apex:page standardController="BXEU_Samples__c" id="pg_Samples_Standard_Page" extensions="cls_BXEU_Sample_New_Related_List" action="{!pageredir}"> </apex:page>

 

Apex Class

 

Controller Class

//Constructor

 public cls_BXEU_Sample_New_Related_List (ApexPages.StandardController controller) {
       obj_Samples=(BXEU_Samples__c)controller.getRecord();
       retURL = ApexPages.currentPage().getParameters().get('retURL');
       rType = ApexPages.currentPage().getParameters().get('RecordType');
       cancelURL = ApexPages.currentPage().getParameters().get('cancelURL');
       ent = ApexPages.currentPage().getParameters().get('id');
        
    }

//Method

 public Pagereference pageredir()
        {
        Pagereference newpage;
        String usrProfileName = [select u.Profile.Name from User u where u.id = :Userinfo.getUserId()].Profile.Name;
           if(usrProfileName.Contains('Austria'))
               { 
                   //newpage = new Pagereference ('/apex/Sample_New_Related_List?RecordType={!obj_Samples.RecordTypeId}&ContactId={!obj_Samples.VAEU_Contact__c}');
                   newpage = new Pagereference ('/apex/Sample_New_Related_List');
               }
           else
                  {
                  newpage=new Pagereference ('/a0w/e');
                
                  
                  }
                  newpage.getParameters().put('retURL', retURL);
                  newpage.getParameters().put('RecordType', rType);
                  newpage.getParameters().put('cancelURL', cancelURL);
                  newpage.getParameters().put('ent', ent);
                  newPage.getParameters().put('nooverride', '1');
                  newpage.setRedirect(true);
                  return newpage;
        }