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
Guru GaniGuru Gani 

I want to display records based on the selections of opportunity stage, please help me to develop the visualforce page and lightning component

Waqar Hussain SFWaqar Hussain SF
See example code to render page block based on Opportunity stage selection.
 
<apex:page standardController="Opportunity" extensions="opportunityController">
    <apex:form >
       
        <apex:selectList value="{!selectedStage }" size="1">
            <apex:selectOptions value="{!PLValues}"  />
            <apex:actionSupport event="onchange" reRender="pb"/>
        </apex:selectList>
    
    <apex:outputText value="{!selectedStage}"></apex:outputText>
    
    
   <apex:pageBlock title="Opportunity details" id="pb">
      <apex:outputText value="{!selectedStage}"></apex:outputText>

        <apex:pageBlockSection id="frstpb" rendered="{!IF(selectedStage =='Qualification',true,false)}">
            <apex:inputfield value="{!Opportunity.Name}"/>
            <apex:inputfield value="{!Opportunity.StageName}"/>
            <apex:inputfield value="{!Opportunity.CloseDate}"/>
        </apex:pageBlockSection>
     
       
        </apex:pageBlock> 
        
        </apex:form>
</apex:page>
 
public class opportunityController{
    Opportunity record;
    
    public opportunityController(ApexPages.StandardController controller) {
        record = (Opportunity ) controller.getRecord();
    }
    
    
    public string selectedStage {get; set;}
    public List<SelectOption> getPLValues() {
        List<SelectOption> plValues = new List<SelectOption>();
        
        Schema.DescribeFieldResult dfr = Opportunity.StageName.getDescribe();
        for (Schema.PicklistEntry ple : dfr.getPicklistValues()) {
            plValues.add(new SelectOption(ple.getValue(), ple.getLabel()));
            if (ple.isDefaultValue()) {
                selectedStage = ple.getValue();
            }
        }
        
        return plValues;
    }
}

 
Guru GaniGuru Gani
Hi 
Waqar Hussain,
Thank you soo much for your reply, its hepls a lot. thanks once again.
Guru.