Query list based on a SharePoint group

  • 4 September 2017
  • 1 reply
  • 3 views

Badge +1

I have a task list which can assign tasks to either users or SharePoint groups and i am trying to create a site workflow that will run once a week to send an email to each of the distict users or groups detailing all of their outstanding tasks.

I can query successfully if the assigned to field is marked as an individual user by using the user ID but i cannot get the query list to return anything if the Assigned To  SharePoint Group.

For Clarification

Workflow Section

This is the issue where the issue is occurring.

Query List Filter

When applying the person or group to perAssignedTo then nothing is returned,  when applying the ID to perAssignedTo then only user details are returned but no record with a group in Assigned To is returned.

Thanks In Advance.


1 reply

Badge +1

Ok I have managed to solve this.

1. In the Query List change it to CAML View and update the Lookup to the following (changing User to int and Ensuring LookupId="TRUE")

      <Eq>
        <FieldRef Name="AssignedTo" LookupId="TRUE" />
        <Value Type="int">{WorkflowVariable:idPerson}</Value>
      </Eq>

2. Grab the ID from the Web Service UserGroup.GetGroupCollection by supplying the groupname in an XML file and parsing the XML for ID and storing this in the idPerson workflow variable.
https://msdn.microsoft.com/en-us/library/websvcusergroup.usergroup.getgroupcollection(v=office.14).aspx

The input XML i generated with a Build String component

<Groups>
<Group GroupName="{WorkflowVariable:perAssignedTo}"/>
</Groups>

I only do this when the returned userID is equal to -1

The overall portion of the flow to get the id of the user or group now becomes the following.

Get Group ID from Web Service

There is probably a much easier way of getting the group ID but this is working for me.

Reply