+ Start a Discussion
luccilucci 

nested map how to use

public Map<String, Integer> getqueuesMap(){

Map<String, Integer> qMap = new Map<String, Integer>();
queuesMap = new Map<String, Id>();
//list<aggregateResult> res=[select group.name,count(ID) from GroupMember group by group.name];
List<Group> roleGrps = [Select Id from Group where Type='Role' AND RelatedId= : UserInfo.getUserRoleId()];
Set<Id> gIds = new Set<Id>();
for(GroupMember grpM : [Select Group.Id, Group.Name from GroupMember where UserOrGroupId IN: roleGrps OR UserOrGroupId =: UserInfo.getUserId()])
{
gIds.add(grpM.Group.Id);
//system.debug(gIds);
queuesMap.put(grpM.Group.Name, grpM.Group.id);
}

list<aggregateResult> results = [SELECT Owner.Name,Count(Id) FROM Case where OwnerId in :gIds group by Owner.Name];

//system.debug('agregateResults' +results);
for (AggregateResult ar : results){
qMap.put(String.valueOf(ar.get('Name')), (Integer) ar.get('expr0'));
}
/* if(qMap.size() != queuesMap.size()){
for(string names : queuesMap.keySet()){
if(String.isNotBlank(names) && !qMap.containsKey(names)){
qMap.put(names,0);
}
}
}*/

return qMap;
}

public void setqueuesmap(Map<String,Id> qmap){

this.queuesmap=qmap;

}

 

 

 

 

 

I am using this code for getting queuenames and count of queuenames, but i want queueids ,is it possible by nestedmaps if can ,how to change this code?

how to done can anybody help me?

 

thanks 

lakshmi