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
Karthikeyan ChandranKarthikeyan Chandran 

Populate record list based on the picklist value chosen?

Hi All,

I have a custom multi select picklist called "Groups__c" in user object. i want to display the users in custom VF page based on the selection from the picklist "Groups--c".

Can anyone help me to fix this ASAP?

Thanks,
Karthikeyan Chandran
Harish RamachandruniHarish Ramachandruni

Hi,

 
<apex:page controller="harishrao" >

<apex:form>
<apex:selectList id="countries" value="{!Group}"
        size="1" required="true">
 <apex:selectOptions value="{!countries}"/>
</apex:selectList>
<apex:commoundbutton value="show" action = "show" />
 
</apex:form>
​</apex:page>

 

public class harishrao
{
public list<user> usa group 
public string group {get;set;}
public List<SelectOption> getCountries()
{
  List<SelectOption> options = new List<SelectOption>();
        
   Schema.DescribeFieldResult fieldResult =
 User.Group__c.getDescribe();
   List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();
        
   for( Schema.PicklistEntry f : ple)
   {
      options.add(new SelectOption(f.getLabel(), f.getValue()));
   }       
   return options;
}


public pagereference show (){


usa = [select id,name form user where Group__c = :group   ]



return null ;
}


}


Use thiscode and any issue ask me ,


Regards,
Harish.R