You need to sign in to do that
Don't have an account?
Deepak Pandey 13
list of user is blank
apex class---
public class roleexten {
public Case cse {get; set;}
public String selectedId {get;set;}
public List<selectoption> UserOptionList{get;set;}
public roleexten(ApexPages.StandardController controller)
{
cse =new Case ();
}
public pagereference assignowner()
{
return page.vfpageownerassign ;
}
public void selected()
{
UserOptionList = new List<selectoption>();
UserOptionList.add(new selectoption('','--None--'));
for(User u :[select id ,name from user ])
{
system.debug('@@@@u' +u);
UserOptionList .add(new SelectOption(u.Id , u.Name));
}
system.debug('@@@@UserOptionList' +UserOptionList );
}
}
vf pages-
<apex:page standardController="Case" extensions="roleexten" sidebar="false">
<apex:form >
<apex:pageblock >
<apex:pageBlockSection >
<apex:pageBlockSectionItem >
<apex:inputField value="{!cse.ownerId}"/>
<apex:actionSupport action="{!selected}" event="onchange" reRender="cont"/>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
<apex:outputPanel id="cont">
<apex:pageblockSection title="Owner" >
<apex:selectList value="{!selectedId }">
<apex:selectOptions value="{!UserOptionList }"></apex:selectOptions>
</apex:selectList>
</apex:pageBlockSection>
</apex:outputPanel>
</apex:pageblock>
</apex:form>
</apex:page>
public class roleexten {
public Case cse {get; set;}
public String selectedId {get;set;}
public List<selectoption> UserOptionList{get;set;}
public roleexten(ApexPages.StandardController controller)
{
cse =new Case ();
}
public pagereference assignowner()
{
return page.vfpageownerassign ;
}
public void selected()
{
UserOptionList = new List<selectoption>();
UserOptionList.add(new selectoption('','--None--'));
for(User u :[select id ,name from user ])
{
system.debug('@@@@u' +u);
UserOptionList .add(new SelectOption(u.Id , u.Name));
}
system.debug('@@@@UserOptionList' +UserOptionList );
}
}
vf pages-
<apex:page standardController="Case" extensions="roleexten" sidebar="false">
<apex:form >
<apex:pageblock >
<apex:pageBlockSection >
<apex:pageBlockSectionItem >
<apex:inputField value="{!cse.ownerId}"/>
<apex:actionSupport action="{!selected}" event="onchange" reRender="cont"/>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
<apex:outputPanel id="cont">
<apex:pageblockSection title="Owner" >
<apex:selectList value="{!selectedId }">
<apex:selectOptions value="{!UserOptionList }"></apex:selectOptions>
</apex:selectList>
</apex:pageBlockSection>
</apex:outputPanel>
</apex:pageblock>
</apex:form>
</apex:page>
All Answers
public class roleexten
{
public Case cse {get; set;}
public String selectedId {get;set;}
public List<selectoption> UserOptionList{get;set;}
public roleexten(ApexPages.StandardController controller)
{
cse =new Case ();
selected();
}
public pagereference assignowner()
{
return page.vfpageownerassign ;
}
public void selected()
{
UserOptionList = new List<selectoption>();
UserOptionList.add(new selectoption('','--None--'));
for(User u :[select id ,name from user ])
{
system.debug('@@@@u' +u);
UserOptionList.add(new SelectOption(u.Id , u.Name));
}
system.debug('@@@@UserOptionList' +UserOptionList );
for(Group gp :[Select Name, Id From Group where Type = 'Queue']) {
UserOptionList.add(new SelectOption(gp.Id , gp.name));
}
}
}