web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / microsoft flow get all...
Power Automate
Unanswered

microsoft flow get all items with distinct Assigned to (User and group) filed

(0) ShareShare
ReportReport
Posted on by 121

Hi

 

I am creating a flow to get all the item assined to a single user and send an email to that user with all the item detail .

 

I dont want to send separate email for each task .

 

Could you please help me with any option . 

 

Thanks

Gautmish

Categories:
I have the same question (0)
  • ScottShearer Profile Picture
    25,270 Most Valuable Professional on at
    Can you tell me where the assigned items are stored? SharePoint? Once I know I will attempt to provide an example.

    Scoty
  • gautmish Profile Picture
    121 on at

    Hi @ScottShearer

     

    Assigned items are stored in sharepoint list .

     

    we have a sharepoint task list where we have created few tasks for different users . One user may have multiple task . So we want to send email to one mail to each user with their task details .

     

    Thanks

    Gautmish

  • Verified answer
    v-xida-msft Profile Picture
    on at

    Hi @gautmish,

     

    Could you please share a bit more about your SharePoint task list?

     

    I have created a SharePoint task list on my side and the data structure of it as below:10.JPG

    I have made a test on my side and please take a try with the following workaround:

    • Add a proper trigger, here I use Flow Button trigger.
    • Add a "Get items" action, specify Site Address and List Name (Type Task list name as a custom value).
    • Add a "Variables"-> "Initialize variable" action, Name set to AssignedToEmailArray, Type set to Array and Value set to empty.
    • Add a "Apply to each" action, input parameter set to value of the "Get items" action. Within "Apply to each" action, add a "Append to array variable" action, Name choose AssignedToEmailArray, Value set to following formula:

     

    first(item()?['AssignedTo'])?['Email']

     

    • Under "Appl yto each" action, add a "Compose" action, Inputs set to following formula:

     

    union(variables('AssignedToEmailArray'),variables('AssignedToEmailArray'))

     

    • Add a "Do Until" action, click "Edit in advanced mode", type the following formula:

     

    @empty(variables('AssignedToEmailArray'))

    Within "Do Until" action, add a "Get items 2" action, specify Site Address and List Name (Type Task list name as a custom value). 

    Add a "Filter array" action, From set to value dynamic content of the "Get items 2" action. Click "Edit in advanced mode", type the following formula:

    @equals(first(item()?['AssignedTo'])?['Email'], first(variables('AssignedToEmailArray')))

    Add a "Select" action, From set to output of the "Filter array" action. Within Map entry, type 5 enties.11.JPG

    The corresponding value of Task Name read as below:

    item()?['Title']

    The corresponding value of Start Date read as below:

    item()?['StartDate']

    The corresponding value of End Date read as below:

    item()?['DueDate']

    The corresponding value of Task Status read as below:

    item()?['Status']

    The corresponding value of Description read as below:

    item()?['Body']

    Note: Please make sure these columns (Title, Start Date, Due Date, Status, Description) that you want to show up within HTML table contain values.

     

    Add a "Create HTMl table" action, From set to output of the "Select" action, Include Headers set to yes. Then add a "Send an email" action, To field set to following formula:

    first(variables('AssignedToEmailArray'))

    Body field set to output of the "Create HTML table" action, Is HTML field set to Yes.

     

    Add a "Compose 2" action, Inputs set to following formula:

    skip(variables('AssignedToEmailArray'),1)

    Add a "Set variable" action, Name choose AssignedToEmailArray, Value set to output of the "Compose 2" action.

     

    Image reference:12.JPG

     

    13.JPG

     

    14.JPG

     

    15.JPG

    The flow works successfully as below:16.JPG

     

    17.JPG

     

     

     

    Best regards,

    Kris

     

  • gautmish Profile Picture
    121 on at

    Hi @v-xida-msft,

     

    Thanks for this help . It is working perfectly .

     

    Thank you ....

    Gautmish

  • Bill_Hand Profile Picture
    45 on at

    Thanks for this walk through.  I am getting an error on the formula: 

    first(item()?['AssignedTo'])?['Email']

     

    'first' expects its parameter be an array or a string.

     

    Any ideas what might be causing this?

     

    Thanks

  • gautmish Profile Picture
    121 on at

    Hi @Bill_Hand

     

    Could you please confirm if you are using Task list or normal list with Assigned to coulmn .

     

    please try below options and let me know if it helps.

     

    1. Assigned to coulmn should be User only field not User and Group

    2. Dont use the same array to make it distinct , create a diffrenet distinct array and use it .

    3. Check the output of Assigned to array if it consists of data

    4. Assigned to coulmn should not be null 

     

    Thanks

    Gautmish

  • fzer0 Profile Picture
    33 on at

    Hi @v-xida-msft

    Many thanks for this solution. I have an issue, flow is sending one email per task - so if I have 4 tasks per user, I receive 4 emails with html table. Where can be an error? I've checked it and seemens everything is as descirbed here.

     

    Best regards

     

     

  • gautmish Profile Picture
    121 on at

    Hi @fzer0


    Could you please check if you have included below union step in your flow.

     Capture.PNG

    Thanks

    gautmish

     

     

  • fzer0 Profile Picture
    33 on at

    Hi @gautmish yes I have. Any other ideas what could be wrong?

  • fzer0 Profile Picture
    33 on at

    Hi, anyone using this kind of flow and have some issues? I still can't manage to solve it 😕

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard