Workflow and ServiceDesk Community

 View Only
Expand all | Collapse all

Help Getting Members of a Service Queue

  • 1.  Help Getting Members of a Service Queue

    Posted May 19, 2014 09:14 PM

    This is the first part of a two-part question. I broke them apart to help people feel they can answer one piece and not the other. What I am looking to do is to enumerate the members of a specific queue and then populate a drop-down list with those members on a webform. I was able to do this in 7.1 by using the LogicBase.Components.Ensemble.UserMan.SearchUser, entering the group name and then outputting that to a variable. Now, that component doesn't exist and if I copy it in it won't return anything and if it did it wouldn't really be what I want since I need the members of the queue.

    Does anyone know how I can get all members of a specific queue and output those to a drop-down list?



  • 2.  RE: Help Getting Members of a Service Queue

    Posted May 20, 2014 09:17 AM
      |   view attached

    I used the auto complete text box component so i could just enter the last name of a person and have it search and pull a list.  In the auto complete I use the Get Group by Name component since I have a specific group but I'm sure you can tweak this for your use, I have attached a screen shot of the search.



  • 3.  RE: Help Getting Members of a Service Queue

    Broadcom Employee
    Posted May 20, 2014 09:20 AM

    It's a multiple stepped process to get the user information for a queue.

    Use Get Incident Service Queue By Name. This returns a ServiceQueueObject which as part of the object contains a ServiceGroup collection containing the Group Name & ID for each group in the Service Queue.

    Next you'll create a for each loop to go through the SecurityGroup collection and running a 'Get Users In Group' or 'Get Users By Group ID' component to pull the user information for each member of the group adding them to your new Users collection.



  • 4.  RE: Help Getting Members of a Service Queue

    Posted May 20, 2014 09:20 AM

    As tickets in 7.5 aren't assigned to groups but to service queues, you'll first need to get the information about the service queue. Two possible ways to do this: via ticket info or by "Get All Service Queues" component. Once you have the queue, you can iterate through the security groups assigned to that queue, get all users in each group, and add the users to your drop down variable.

    So, if you are working with an IM and have the session id, you can use "Get Incident Ticket By SessionId" to get the IM ticket info. This variable will contain a property of "Currently Assigned Queue" and that property will have a property that is an array of security groups mapped to that queue. Obviously, this is only useful if you are wanting the user info for the currently assigned queue, so it may not be what you are after.

    The second option will definitely get you what you want, but it may take longer depending on how many queues you've got. You can use "Get All Service Queues" to get an array of queues which, again, will have a property of security groups. Iterate through those groups and either "Get Users By Group ID" or "Get Users In Group". "Get Users By Group ID" will provide much more info for each user, so it would likely eliminate any need for a call for additional user info.

    Third option that I haven't mentioned yet. A custom component to pull directly from the SQL DB. You'd need to work with "ImServiceQueue", "ServiceQueueGroupMap", "Group", "User", and "UserGroup", I'm guessing. But you could make it do exactly what you need in a single component.



  • 5.  RE: Help Getting Members of a Service Queue

    Posted May 20, 2014 09:33 AM

    Addendum: For the heck of it, I made a quick query if you wanted to go that route.

    SELECT USR.[PrimaryEmail]
    FROM [User] USR
    JOIN [UserGroup] UG ON USR.[UserID] = UG.[UserID]
    WHERE UG.[GroupID] IN
        (SELECT [GroupID] FROM [ServiceQueueGroupMap] WHERE [ImServiceQueueId] IN
            (SELECT [ImServiceQueue_id] FROM [ImServiceQueue] WHERE [QueueName] = @QueueName)
        )



  • 6.  RE: Help Getting Members of a Service Queue

    Posted May 20, 2014 09:36 AM
      |   view attached

    Lets try this again. I tried posting this but it doesnt seem to be showing up. Here is a custom package for sd incident managmetn simple classification that does what your looking for. check out the edit incident form for the Specific queue search. Assignmetents are on the save path.



  • 7.  RE: Help Getting Members of a Service Queue

    Posted May 20, 2014 12:17 PM

    OK, I'm not asking anyone to do this for me but maybe a little more clarification. Dave, your suggestion will work fine assuming I add the group into ProcessManager's settings to make them available for use as a property. In this case I'd like to avoid it (although I did do it a lot in 7.1). In this case the queue is Helpdesk and there is only one group assigned to it but there could be more in the future. 

    @TGiles, I get what you're suggesting, and it makes sense...mostly. The problem I have, and this is with Workflow in general, is that nothing is clear as to what data types are what and which components are assigned to which data types. If I use "Get Incident Service Queue by Name" then I get a ServiceQueueObject but when I go to put that before a "For Each Element in Collection" component, what array variable type do I use there? There are several different ServiceQueue types but none of them allow me to choose the variable outputted from the "Get Incidet Service Queue by Name". There are also a large number of Group type choices as well so getting the right one is proving to be a tough task! I imagine once I can find the right variable type I might be able to enumerate through the list and get all of the groups. Then I need to do it all again but finding the users in each group and I imagine I might have the same variable type issue there too.



  • 8.  RE: Help Getting Members of a Service Queue

    Posted May 20, 2014 04:36 PM

    I am getting closer, that's for sure. I've taken apart a little bit of the package from @dave.loder and modified it a bit but there are still issues that have to do with the datatypes and perhaps some of the components used as well.

    Screen Shot 2014-05-20 at 4.02.48 PM.png

     

    Here's where I'm at with the above screenshot. I hope you can follow along. I initialize a data element to be used later then get the ServiceQueue for Helpdesk by name. I then pass that into a For loop and that's where problem number 1 starts. I don't know what variable type to choose. I can sort of get it to work if I choose ServiceQueueGroupMap but that will only allow me to select a [first] or [last] in the Get Group By Name component...doesn't work so well when you have more than one group in a queue! That aside, we then move on to Get Users By Group ID, which works, and the users from the group are in a User array. Then we stop functioning right and this is where I might be able to use different components. The Configurable Filter should be working. I have verified that PrimaryEmail does exist in the user accounts in the array from the element prior however the array that comes out of this filter is empty. I imagine that if it was populated then the rest work work as expected (except that I will go through the loop again for each group but only ever re-filter the same group since its either First or Last).

    I am close!

     

    I should mention that I'd like to do a drop-down because its less typing. This form is for a single, specific incident type where we need to create multiples of them very quickly and the less typing, the better.



  • 9.  RE: Help Getting Members of a Service Queue
    Best Answer

    Broadcom Employee
    Posted May 21, 2014 09:50 AM
      |   view attached

    Okay. The Service Queue object will return a collection of ServiceGroups. If you browse data and put a check into the Show Data types option it will tell you what type of object the ServiceGroups collection is. You can then use that information in your For Each Loop.

    Don't know why you are using the 'Configurable Collection Filter' component after getting the 'Users By Group ID' component. After you get the 'Get Users By Group ID' component you should just be able to drop the results of that into a 'Add Items to collection' component that contains the list of users. If you are concerned about having duplicates in the collection I would put a 'Test Collection For Duplicates' component coming out of the finish line of your first For Each loop component. From there you can then sort the collection.

    I've attached a sample project. Hope it helps.

    Attachment(s)

    package
    ServiceQueues.package   1.41 MB 1 version


  • 10.  RE: Help Getting Members of a Service Queue
    Best Answer

    Posted May 21, 2014 10:51 AM

    Thanks for the upload! I had just finished making the changes you had recommended and have nearly exactly what you posted but was still having type issues...seeing UserInfo the whole way through cleared that up a lot!

     

    I thinkk I'm good to go now!