How to get picklist values based on record type in Visualforce page?

Visualforce page:

<apex:page controller="Sample">
    <apex:form >
        <apex:inputField value="{!objEmp.Approval_Status__c}"/>
        <br/><br/><br/>
        <apex:inputField value="{!objEmp1.Approval_Status__c}"/>
    </apex:form>
</apex:page>

Apex Class:

public with sharing class Sample { 
    
    public Employee__c objEmp {get;set;}
    public Employee__c objEmp1 {get;set;}
    
    public Sample() {
        objEmp1 = new Employee__c(RecordTypeId = '0120P000000EDfb');
        objEmp = new Employee__c(RecordTypeId = '0120P000000EDfg');
    }
    
}

Output:

Record Type which has one value


Record Type which has multiple values


Cheers!!!

No comments:

Post a Comment