Service Desk Practitioners Forum
cancel

Java - query on multiple assigned workgroups?

Highlighted
Michael Tutty
Contributor.

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
Super Contributor.

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
Contributor.

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?