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
Vignesh NayakVignesh Nayak 

Record types + Apex + VF

Hi All,

Suppose i have a object with
1) 2 Record types RT1 and RT2
2) 1 Picklist named version with 6 values (V1, V2, V3, V4, V5,V6) [3 values restricted to RT1 and other 3 to RT2]
    i.e., RT1 has V1, V2, V3 and RT2 has V4, V5,V6.

Now, I created a VF page with standard controller and defined the picklist field (version) on the page.
Problem : I am able to see only 3 values (V4, V5,V6) on the vf page.

Please suggest me a way so that all 6 picklist values gets displayed on the vf page irrespective of Record type.


Regards,
Vignesh
 
PratikPratik (Salesforce Developers) 
Hi Vignesh,

Are you referring to any recordtype in your class? If you can post your code so we can help to correct.

The picklist values will be shown for the Default Recordtype assigned to the user profile.

Thanks,
Pratik
 
BalajiRanganathanBalajiRanganathan
Try using describe to get the picklist values and display it using seletoption in the VF

Refer this link below
https://developer.salesforce.com/blogs/developer-relations/2008/12/using-the-metadata-api-to-retrieve-picklist-values.html
Vignesh NayakVignesh Nayak
Hi Pratik,

Im not refering any recordtype in my controller.

Code :

 <apex:pageBlock title="Please Enter The Details For Searching">
            <apex:pageBlockButtons location="Bottom">
                <apex:commandButton value="Search" action="{!Csets}" reRender="csetList" />
            </apex:pageBlockButtons>
            
            <apex:pageblocksection >
                <apex:inputField value="{!Cset__c.name}"  />
                <apex:inputField value="{!Cset__c.Version__c}"/>
                <apex:inputField value="{!Cset__c.Applicability__c}" />
                <apex:inputField value="{!Cset__c.Testing_Internal__c}"/>
            </apex:pageblocksection>
            
            </apex:pageBlock>


I'm using a standard controller.


Thanks,
Vignesh.
PratikPratik (Salesforce Developers) 
Hi Vignesh,

Thanks for information.

The default recordtype assigned to the user profile will be considered for showing the picklist value.  This is as per user permission through recordtypes.
If you want to show all the values, you can use the dynamic way to retrieve it as Balaji mentioned.

Thanks,
Pratik
 
Vignesh NayakVignesh Nayak
Hi Pratik,

Is tha tthe only way ?

Regards,
Vignesh
PratikPratik (Salesforce Developers) 
Hi Vignesh,

It seems to be the way for doing it.

There can be a workaround, just an idea you can try it.
You can create a picklist field (just a placeholder) with all the values and show that field on VF page and internally through code refer the values to the recordtype & original picklist field.

Let me know how it goes.

Thanks,
Pratik