Filter A SharePoint Multiple Person Type Column With No Delegation Warning
Setup The SharePoint List
Create a SharePoint list named Projects Backlog with the following columns:
- ID – autonumber column
- Title – text column
- ProjectTeam – person column with allow multiple selections set to true
ID | Title | Project Team |
1 | Time Off Request App | Ali Shahzad |
2 | Safety Incidents Reporting | Ahmad Raza |
3 | Job Site Inspection App | Muhammad Mudassar |
4 | Expense Report App | Muhammad Ali |
Build The Power Automate Cloud Flow
Launch Power Automate and craft a new cloud flow titled ‘FilterMultiplePeople‘
Integrate the Power Apps V2 trigger that has a mandatory field named ‘Claims‘.
Next, incorporate a ‘SharePoint – Get Items‘ action that focuses on the ‘Projects Backlog‘ list.
Enter the following code into the ‘Filter Query‘ field to filter based on multiple person types in the column. The column name in SharePoint is ‘ProjectTeam‘.
ProjectTeam/Name eq 'triggerBody()['text']'
Proceed with the process by following these steps.
Apply the filter action: ‘Selected filter‘.
Insert the value of ‘Get items‘ into the ‘From‘ section, and in the Map section, include ‘ID‘, ‘Title‘, and ‘Your SharePoint Person type column name‘.
Insert ‘Compose‘ beneath the ‘filter‘.
Place the filter result in the compose input area.
Insert a new ‘Respond to a PowerApp or flow‘ action beneath the Compose. It should have a mandatory field named ‘response‘. Then, link the output from the Compose to it.
Return The Flow Response To Power Apps
Create a ‘People Picker‘ combobox menu to choose an individual’s name. Discover how to craft this selector by going through this guide.
Connect the 'FilterMultiplePeople' flow to Power Apps.
Navigate to the PowerApp where you intend to implement the ‘FilterMultiplePeople‘ flow and establish a connection with it.
“Place this code in the button’s OnSelect attribute. It sends the claims token of the chosen individual to the flow and retrieves a JSON containing corresponding results. Subsequently, the ParseJSON function is employed to transform the JSON into a collection.
colProjects,
ForAll(
Table(ParseJSON(FilterMultiplePeople.Run($"i:0#.f|membership|{DataCardValue7.Selected.UserPrincipalName}").response)),
{
ID: Value(Value.ID),
Title: Text(Value.Title),
ProjectTeam: ForAll(
Table(Value.ProjectTeam),
{
Claims: Text(Value.Claims),
DisplayName: Text(Value.DisplayName),
Email: Text(Value.Email),
Picture: Text(Value.Picture),
Department: Text(Value.Department),
JobTitle: Text(Value.JobTitle)
}
)
}
)
)
The colProjects collection displays results that match ‘Ali Shahzad‘ in the ProjectTeam field.
Filter A Sharepoint Multiple Choices Type Column With No Delegation Warning
Setup The SharePoint List
Construct a SharePoint list titled ‘Projects Backlog’ comprising the subsequent columns:
- ID: This is an automatic numbering column.
- Title: A column for text input.
- SkillsRequired: A choice column configured to allow multiple selections.
Listed entries are as follows:
ID | Title | SkillsRequired |
---|---|---|
1 | Time Off Request App | Power Apps |
2 | Safety Incidents Reporting | Power Apps, Power Automate, Power BI |
3 | Job Site Inspection App | Power Apps, Power Automate |
4 | Expense Report App | Power Apps, Power BI, Power Virtual Agent |
Build The Power Automate Flow
Launch Power Automate and craft a new cloud flow titled ‘FilterMultipleChoices‘
Integrate the Power Apps V2 trigger that has a mandatory field named ‘Claims‘.
Next, incorporate a ‘SharePoint – Get Items‘ action that focuses on the ‘FilterMultipleChoices ‘ list.
Enter the following code into the ‘Filter Query‘ field to filter based on multiple person types in the column. The column name in SharePoint is ‘FilterMultipleChoices’.
Department/Id eq 'triggerBody()['text']'
Proceed with the process by following these steps.
Apply the filter action: ‘Selected filter‘.
Insert the value of ‘Get items‘ into the ‘From‘ section, and in the Map section, include ‘ID‘, ‘Title‘, and ‘Your SharePoint Person type column name‘.
Insert ‘Compose‘ beneath the ‘filter‘.
Place the filter result in the compose input area.
Insert a new ‘Respond to a PowerApp or flow‘ action beneath the Compose. It should have a mandatory field named ‘response‘. Then, link the output from the Compose to it.
Return The Flow Response To Power Apps
Construct a dropdown menu enabling the user to choose a value from the Department lookup options.
Navigate to the PowerApp where you intend to implement the ‘FilterMultipleChoices ‘ flow and establish a connection with it.
Insert this code into the button’s OnSelect property. It forwards the selected individual’s claims token to the flow and fetches a JSON with the relevant results. Following that, the ParseJSON function is used to convert the JSON into a collection.
ClearCollect(
colProjects,
ForAll(
Table(ParseJSON(FilterMultipleChoices.Run(DataCardValue3.Selected.Value).response)),
{
ID: Value(Value.ID),
Title: Text(Value.Title),
SkillsRequired: ForAll(
Table(Value.SkillsRequired),
{
ID: Value(Value.ID),
Value: Text(Value.Value)
}
)
}
)
)