Service Desk Practitioners Forum
cancel
Showing results for 
Search instead for 
Did you mean: 

Java - query on multiple assigned workgroups?

Highlighted
Michael Tutty
Occasional Advisor

Java - query on multiple assigned workgroups?

Is there any way to specify a list of assigned workgroups for a ServiceCall query?
2 REPLIES
Tommy Koronen_1
Regular Collector

Re: Java - query on multiple assigned workgroups?

Hi,

You can only query for one workgroup at a time.

One thing you can do is to create an java.util.ArrayList to collect the result from multiple queries.
Here's a sketch/idea on how you might do it:

ArrayList CallList = new ArrayList();
for (int g = 0; g < WorkGroups.length; o++) {
AssWhere = AssHome.createAssignmentWhere();
AssWhere.addCriteriumOnAssWorkgroup(WorkGroups[g]);
ScWhere = SCHome.createServicecallWhere();
ScWhere.addCriteriumOnAssignment(AssWhere);
SCs = sc_hm.findServicecall(ScWhere);
CallList.addAll(Arrays.asList(SCs));
}
ServiceCalls = (IServicecall[])CallList.toArray(new IServicecall[0]);

(I've left out declarations etc, but I hope this helps anyway)

BR/Tommy
Michael Tutty
Occasional Advisor

Re: Java - query on multiple assigned workgroups?

Thanks for the response. That's what I'm currently doing, but for someone who's in many groups this will be pretty slow. Is this what the SD client does today, or is there a better way to get the tickets that a given user is associated with?
//Add this to "OnDomLoad" event