cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
YAYA
Helper I
Helper I

filter get items by assigned manager and send for approval

I have a sharepoint task list, in this list we have manager assignee column, some items have different managers to approve, and some other have the same manager.

in power automate how to filter these items so each manager get ONLY his assigned items in approval details to approve!

 

Thanks, 

2 ACCEPTED SOLUTIONS

Accepted Solutions
NiloferA
Responsive Resident
Responsive Resident

@YAYA Oh, I see.

You can do that as well 😉

So, lets look at it step by step.

  1. Get all the items from the List
  2. We need to get a list of all the unique managers, so that we can later filter on the items which are assigned to them. To achieve this
    1. Add a Select action, pass value from Get Items and configure it as follows
    2. NiloferA_5-1620054915476.png
    3. Add this expression in value of the Map section- item()['Name of Assignee Field']['DisplayName'] (You can replace DisplayName with Email here as well to make sure we get unique managers later in the process)
    4. Above action will give output of Array with all the Managers in each item in the List. Let's remove the duplicates and get Unique List of Manager
    5. Add a Compose action, and configure it as follows. This will provide an array of Unique Managers.
    6. NiloferA_6-1620055077825.png
  3. Now we need to filter the items assigned to each of these managers. To achieve this
    1. Add an Apply to each action and pass the Output from Compose
    2. Within Apply to each, add Filter Array action and configure it as follows
    3. NiloferA_4-1620054085033.png
    4. In the first textbox, add the following expression - item()['Name of the Assignee Field']['DisplayName'] (OR Email as mentioned previously) and in the second textbox add the following expression - items('Apply_to_each')['Managers']
    5. This will give you an Array with the json objects representing list items assigned to the current manager in the iteration
    6. You will have to add a Select action to select only the fields you want to send in the Approval.
    7. NiloferA_3-1620054058374.png
    8. You will have to apply some formatting depending on how you want the information to be displayed in the Details section of the Approval
    9. Then you can add Start and Wait for Approval action and pass the formatted text in the Details section
  4. Hope this gives you insight on how you can filter items assigned to each Manager in your Task List.

    Please give a Kudo or Mark this Reply as a Solution if you found it helpful.

     

     

View solution in original post

NiloferA
Responsive Resident
Responsive Resident

Ok, so basically I tried the below approach and it worked for me.

  1. Initialize a String Variable in the beginning of the Flow
  2. In the Apply to each, after Select add Set the Variable action and add the following value
    1.  |Title|Link|
      |-----|-----|
    2. Please make sure to press enter after the second line so that there is a space at the end, this will ensure that the new value is appended at the next line.
    3. NiloferA_0-1620071328476.png

       

  3. Then add another Apply to each and pass Output from Select as Input here.
  4. Within this Apply to each, add Append to String Variable and configure it as below
    1. NiloferA_1-1620071375210.png
    2. First Expression is items('Apply_to_each_2')['Title']

    3. Second Expression is items('Apply_to_each_2')['Link]
    4. Please make sure to press enter after the first line so that there is a space at the end, this will ensure that the new value is appended at the next line.
  5. Then after the Inner Apply to Each action add Start and wait for an Approval Action and pass the string variable in Details.
    1. NiloferA_2-1620071651612.png

Let me know how this goes for you!

View solution in original post

6 REPLIES 6
NiloferA
Responsive Resident
Responsive Resident

Hello @YAYA ,

Do you mean you want to show items where Managers can only see the ones assigned to them in the SharePoint Tasks List?

If yes, then all you need to do is create a Filtered View by following below steps

  1. Create a View
  2. Give it a name, select the columns you want to show in this View and other settings as you would like
  3. in the Filter Section select Manager Assignee Column, keep the condition as "is equal to" and in the value add [Me]. This View will only show the items assigned to the Logged in User.

NiloferA_0-1620030627726.png

 

Hope this answers your question.

Please give a Kudo or mark this Reply as a Solution if you found it helpful.

Thank you for the reply, actually what I am looking for is in power automate how to filter the items for each assigned manager and put these items in approval details accordingly to approve. so each manager get his items to approve. 

thanks

NiloferA
Responsive Resident
Responsive Resident

@YAYA Oh, I see.

You can do that as well 😉

So, lets look at it step by step.

  1. Get all the items from the List
  2. We need to get a list of all the unique managers, so that we can later filter on the items which are assigned to them. To achieve this
    1. Add a Select action, pass value from Get Items and configure it as follows
    2. NiloferA_5-1620054915476.png
    3. Add this expression in value of the Map section- item()['Name of Assignee Field']['DisplayName'] (You can replace DisplayName with Email here as well to make sure we get unique managers later in the process)
    4. Above action will give output of Array with all the Managers in each item in the List. Let's remove the duplicates and get Unique List of Manager
    5. Add a Compose action, and configure it as follows. This will provide an array of Unique Managers.
    6. NiloferA_6-1620055077825.png
  3. Now we need to filter the items assigned to each of these managers. To achieve this
    1. Add an Apply to each action and pass the Output from Compose
    2. Within Apply to each, add Filter Array action and configure it as follows
    3. NiloferA_4-1620054085033.png
    4. In the first textbox, add the following expression - item()['Name of the Assignee Field']['DisplayName'] (OR Email as mentioned previously) and in the second textbox add the following expression - items('Apply_to_each')['Managers']
    5. This will give you an Array with the json objects representing list items assigned to the current manager in the iteration
    6. You will have to add a Select action to select only the fields you want to send in the Approval.
    7. NiloferA_3-1620054058374.png
    8. You will have to apply some formatting depending on how you want the information to be displayed in the Details section of the Approval
    9. Then you can add Start and Wait for Approval action and pass the formatted text in the Details section
  4. Hope this gives you insight on how you can filter items assigned to each Manager in your Task List.

    Please give a Kudo or Mark this Reply as a Solution if you found it helpful.

     

     

View solution in original post

Thank you, this helped me a lot, one issue though! I have done parse JSON after filter array to get the columns that I need to show in approval details and it works BUT when I added the parse json items in the approval details, it put me inside apply to each loop and the approval sent per item, so the assigned manager get his own items one by one instead of get them all in one approval table! 

 

 

 

 

1.png2.png

NiloferA
Responsive Resident
Responsive Resident

Ok, so basically I tried the below approach and it worked for me.

  1. Initialize a String Variable in the beginning of the Flow
  2. In the Apply to each, after Select add Set the Variable action and add the following value
    1.  |Title|Link|
      |-----|-----|
    2. Please make sure to press enter after the second line so that there is a space at the end, this will ensure that the new value is appended at the next line.
    3. NiloferA_0-1620071328476.png

       

  3. Then add another Apply to each and pass Output from Select as Input here.
  4. Within this Apply to each, add Append to String Variable and configure it as below
    1. NiloferA_1-1620071375210.png
    2. First Expression is items('Apply_to_each_2')['Title']

    3. Second Expression is items('Apply_to_each_2')['Link]
    4. Please make sure to press enter after the first line so that there is a space at the end, this will ensure that the new value is appended at the next line.
  5. Then after the Inner Apply to Each action add Start and wait for an Approval Action and pass the string variable in Details.
    1. NiloferA_2-1620071651612.png

Let me know how this goes for you!

View solution in original post

YAYA
Helper I
Helper I

@NiloferA thanks, it works 🙂 

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (2,172)