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
S SaiS Sai 

In Visualforce Page Public Group Wise Users

Hi Good Morning,

In visualforce Page i Want to create Picklist Values of publicGroup.when iam selecting and serch button then show the particular publicgroup users

Thanks
SS
Gyanender SinghGyanender Singh
Hi S S,

As per your requirement you want to show public groups in the picklist in the VF page , So Please implement the following Controller and the Vf Page and let me know your requirement is solved.

Apex Class:
public class showPublicGroupController {
    String[] selectedGroups = new String[]{};
    public String[] getSelectedGroups() {
        return selectedGroups;
    }
    public void setSelectedGroups(String[] groups) {
        this.selectedGroups = groups;
    }
    List<SelectOption> AllPublicGroups;
    public List<SelectOption> getAllPublicGroups()
    {
        if(AllPublicGroups == null){
            AllPublicGroups = new List<SelectOption>();
            for(Group g : [Select Id,Name from Group where Type = 'Regular']){
               AllPublicGroups.add(new SelectOption(g.Id,g.Name));
            }   
        }
        return AllPublicGroups;   
    }
}

Vf Page:
<apex:page controller="showPublicGroupController " >
<apex:form >
<apex:selectList value="{!SelectedGroups }">
    <apex:selectOptions value="{!AllPublicGroups}"/>
</apex:selectList>
</apex:form>
</apex:page>

Thanks
Gyani
 
S SaiS Sai
hi Gyanender Singh

Iwant to display publicgroup users.

thanks 
SS