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
qraishqraish 

Record Type and Picklist: Select both in a single VF Page?

Hi All,

 

In a visualforce page, we can display picklist values based on the profile of logged in user and record type settings simply by using something like..

<apex:inputField id="testid" value="{!Case__c.Status__c}" />

 

However, I am seeking for some tips to achieve something like this in a single VF page...

 

- In picklist Field A, user will select one record type from a list of record types (These record types for an object would have already been configured in the back end) ...

- In the same page, another Picklist field B (whose values are dependent on the record type) gets populated with a list of values based on the record type selected in Field A...(The values displayed in Field B would have already been configured in the back end)....

 

Could it be done in a single VF page without or with the use of an extension?

 

Thanks in advance for any insights!!

 

QR

 

 

 

SarfarajSarfaraj

<apex:page standardcontroller="Account"> <apex:form > <apex:pageBlock id="main"> <apex:pageBlockSection > <apex:inputField value="{!account.RecordTypeId}"> <apex:actionSupport event="onchange" reRender="Type"/> </apex:inputField> <apex:inputField value="{!account.Type}" id="Type"/> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>

 This code rerenders only the field type. Write reRender = "main" if you want to reRender the entire section.

qraishqraish

Thank you for your insights Akram. Will test it out and be back with an update :)