unsure if this is the right place to post this question but i'm trying to iterate over each member(User) of a task Queue in flow. However, after querying the record, I am only able to access the 'GroupId' of the Queue(Group). Not the UserId which i require to send a notification. enter image description here

Is there a way of iterating over a Task Queue in flow and being able to access the UserId of all of the queue members so I can send a notification to each of them?

Thanks for any help in advance.


1 Answer 1


It seems you're using the out of the box Send Custom Notification action. Looking at Recipient Ids, you'll see it has expectations:

The ID of the recipient or recipient type of the notification.

Valid values are:

User ID—The notification is sent to this user, if this user is active.

Account ID—The notification is sent to all active users who are members of this account’s Account Team. Valid only if account teams are enabled for your org.

Opportunity ID—The notification is sent to all active users who are members of this opportunity’s Opportunity Team. Valid only if team selling is enabled for your org.

Group ID—The notification is sent to all active users who are members of this group.

Queue ID—The notification is sent to all active users who are members of this queue.

I bolded the above as you might not need to do any queries if your goal is just to notify all members of a group. You can just pass the Group Id to this notification action and skip querying GroupMember records entirely.

However, if you want to notify only specific members of a group (some criteria) - you can still utilize the UserOrGroupId values but you'll have to store it in a way that the action will accept for that parameter

This parameter accepts collection variables of type Text and is limited to 500 values.

As such, you can create a collection variable of type text, do a for loop on your GroupMember records, create an assignment to add the UserOrGroupId value to the collection variable. Afterwards, you can then pass collection variable into Recipient Id.

Leaving below info for purposes of understanding scope of how users can be members of a group.

You'll want to use your identified Group (Id) to query against GroupMember which represents a user or group that is a member of that group/queue

Below, is an example query which you could do in Flow.

SELECT UserOrGroupId FROM GroupMember WHERE GroupId = yourGroupId

You'll then iterate over the results to send notifications to each User.

An important note is that GroupMember can be a User or Group (UserOrGroupId). Meaning, a user could be a part of a group that is a member of the queue you're interested in. Likewise, adding users by role or role & subordinate would be another avenue for users to be a part of that queue. You can easily see these other ways of adding users to be a part of the group in the UI when adding queue members

enter image description here

If your goal is to truly get everyone added, you'd have to do several more queries

  • Get all groups that are a part of the queue membership (store all GroupIds)
  • Another query to get all GroupMember records for all the groups within the queue
  • Get all user roles added to queue (and possibly get all subordinate roles)
  • Query all users in the relevant role or subordinate role
  • Make sure there's no duplicates in terms of users directly added as members of the queue and part of another group/role added as a member

If the above isn't relevant, then your task should be simpler in that you can do what's mentioned at the top - iterate on the users who are returned as GroupMember records for your given queue.

  • 1
    a built-in feature that returned all members for a group (traversing through all hierarchies) would be useful for this oft-occuring OP (of course limits come into play for large orgs)
    – cropredy
    Feb 28, 2022 at 17:21
  • Hi, Thanks for responding in such elaborate fashion. The problem is that I already am querying the GroupMember object. And it seems that I am not able to access the GroupOrUserId from the records in the queue. It only allows me to work with the GroupId as seen in the screenshot of my original post. Are we simply not able to do this in flow or am I missing something critical? Mar 1, 2022 at 13:56
  • I've updated my answer to actually answer your specific scenario (and left the previous answer for informational purposes). Thanks for clarifying and let me know if I misunderstood what you're doing. Mar 1, 2022 at 14:14
  • Works like a Charm, thanks for bailing me out! Mar 2, 2022 at 8:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .