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 / Get items from Child L...
Power Automate
Unanswered

Get items from Child List and Email users from main list proving summary of child list items

(0) ShareShare
ReportReport
Posted on by 39
I have two microsoft lists, main one called A1 and a child list called Scheme Updates.
 
Within the A1 i have items called schemes allocated to a single person. In the scheme updates i am adding updates for each scheme.
 
Every month i want to check which schemes have no updates or have an update that more than 2 weeks ago and them email each person the scheme is allocated, a list of the schemes that they need to update. 
 
I have followed this example https://youtu.be/v54QozIEGyw?feature=shared and i can email engineers a list of items from the main list.  
 
I have an apply to each for my Scheme Updates and i can filter the items that meet my criteria in the child list.
 
I dont know how i can save the scheme details in a way that i can then email them to the person 
 
Any ideas?
 
I
Categories:
I have the same question (0)
  • Suggested answer
    Michael E. Gernaey Profile Picture
    53,335 Super User 2025 Season 2 on at
     
    Please do not send links for what you followed, we need to see what you have done specifically. We cannot debug someone elses code that probably worked or they wouldn't have recorded it hehe.
     
    Ok so, without seeing what you have here are some instructions based on educated guesses which (wastes a lot of time) versus just sharing what you have..
     
    1. Trigger ( I have no idea when you want to trigger, but I am assuming a Reocurring trigger every day at some set time)
    1b. Create an Array, that we will use to store the line items to email about.
    --I suggest that you actually initialize it with headers so when you send the table its nice looking with headers to the user
     
    2. Get items A1
    3. Select (only pulling the person's email address who owns that line. You will want to get into advanced mode in the Select to click the little button. since all we need is literally the Dynamic Column  nothing else
     
    4. A Compose so we can get the Unique Email addresses or whatever you use to identify people, since I am assuming they can have more than 1
    -type the expression union(body('Select', body('Select'))
     
    This will give you a unique list of users nothing else
     
    5. Add an Apply to each with the output of #4 so we can loop through each users specific rows in the secondary list
    --Inside the apply to each
    5a. add a Filter Array.
    ---The input comes from step 2 (the original get items)
    ---The left side should be the dynamic property for the email/unique identifier
    ---middle = is equal to
    ---right = item() <== since we only added the dynamic property its the ONLY column of data and it has no header, so we are just looping through unique strings
     
    5b Add another apply to each and use the data in step 5a, because we need to see if there is a record in the other table (and if not email) OR if the record in the other side is over 2 weeks or whatever and email.
     
    5b. Add another Get Items <== with the filter being the current
    5c. add a condition to check the expression length(Dynamic value from 5b) is equal to 1
    --why do we do this? Because we will either get 1 row or 0 rows for that Scheme/Person in the second table
    In the Yes side, we assume 1 means yes
    --In the yes side, you can check if its been more than 2 weeks by using a condition
    have the condition check if its more than 2 weeks and if so, then use the Append Array, to add the information about the scheme , so we have it for the email
     
    In the No Side,
    we do not need a condition, it didn't find any records, so you just need to use Append Array to add the information about the scheme , so we have it for the email
     
    I would suggest having a Column Header like Reason
    when there is no record, the reason is No Record
    when its more than 2 weeks, the reason is More than 2 weeks old
     
    NEXT Email them wtih data
    1. Outside the 5B apply to each (remember that one is building up the information we want to send to the user), but still inside the step 5 Apply to each
    we want to add a Create HTMl Table action. Using the Array as the input and selecting that there are headers
    2. Now add a Send Email V2
    For the body put whatever you want, but also put the outputs of the Create HTML Action to add the table.
    If you want to make it pretty looking you need to use CSS. Like this
     
    OK, now your work will loop through and capture then email the people.
     
    Please please, go through each step, read it carefully and just create the flow as it states, then come back if you have questions, but its in order as is needed.
     
    The only thing I do not know is, what is the unique identifier between the 2 lists and for sure, if the users email is in the line items in A1.
     
    But you have to be able to group by the Person who owns the line items in A1. If you cannot then you cannot send them an email with their details.
     
    Heck draw it on paper if you need too to get it down and understandable :-)
     
    If this answers you question please Mark as such and maybe a like.
     
    Thanks
     
  • GT-05111229-0 Profile Picture
    39 on at
     
    Thank you for the reply, I have managed to get the correct data at Append to array variable 2.
    In my main list A1 i have the users with their email address which im using to filter the A1 , the only relationship with the scheme updates is the varRecord in Scheme Updates has the ID from A1.
     
    I am struggling now to get an html table to include to the email it doesnt work
     
  • Michael E. Gernaey Profile Picture
    53,335 Super User 2025 Season 2 on at
     
    Promise I will respond today in a few hours I am busy atm but I will respond as you did what I asked and built it out.
    I will help you get it working
     
  • GT-05111229-0 Profile Picture
    39 on at
    Hi Michael, i am still trying to find a solution to this so if you know how i can get the data in table to email to each engineer that would be great/
     
    Thanks
  • Tomac Profile Picture
    3,948 Moderator on at
    Looks like you're sending the email outside of the Apply To Each, so you won't have access to what's generated inside of it.
     
    Move your Send An Email action into the Apply To Each below your Create HTML Table action and you'll have access to it.
  • GT-05111229-0 Profile Picture
    39 on at
    Hi I have tried this and i can indeed get the table when i move the email within the apply to each.
     
    However, i then get an email for each scheme instead of one email per engineer
     
    in
    apply to each 1 i use outputs('Compose_Emgineers_Email_Union')
    apply to each 2 i use  body('Parse_JSON_2')
     
     
  • Tomac Profile Picture
    3,948 Moderator on at
    Instead of converting to an HTML table and sending the email inside the second Apply to Each, you'll want to append the results of that loop to an array variable. Then after the second Apply to Each ends, convert that array to an HTML table and send the email with those outputs.
  • GT-05111229-0 Profile Picture
    39 on at
    Thanks for this
    I managed to do this but i get too many columns
     
    im trying to limit columns but it creates an apply to each using the  Get items A1 and i cant as it creates  a loop..
    i tried limit json but that doesnt work either
    {
        "type": "array",
        "items": {
            "type": "object",
            "properties": {
                "Title": {
                    "type": "string"
                },
                "CostCode": {
                    "type": "string"
                },
                "Engineer1": {
                    "type": "object",
                    "properties": {
                        "DisplayName": {
                            "type": "string"
                        }
                    },
                    "required": [
                        "DisplayName"
                    ]
                }
            },
            "required": [
                "Title",
                "CostCode",
                "Engineer1"
            ]
        }
    }
     
     
  • Suggested answer
    Tomac Profile Picture
    3,948 Moderator on at
    Ah, I didn't see that your JSON was that complicated.
     
    Going back to the previous 2 Apply to Each actions method, append the output of your Create HTML Table action to a string:
     
    Then use that strHTML variable in the body of your email outside of the second Apply to Each action. Your email will have multiple tables but contain all of the required information in a single email
  • GT-05111229-0 Profile Picture
    39 on at
    Thanks Tomac.. but i am trying to email each engineer a list of their schemes
     
    Is it possible to email each engineer their own list of schemes? 
     
    i tried this way but it doenst work..
     
     
     

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