Skip to main content
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
1 answer
  1. Sep 19, 2016, 6:46 PM

    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

     
0/9000