I have 2 SharePoint Lists. A master list and a details list. I am adding items to the lists via a PowerApp and that part works just fine. When I add an item, it adds "main" information on the master list with the "ID" numeric field being populated by default. Then on the second list I have detailed lines, and each line has a "MasterID" that is the same number as the ID field in the master list. This is how I can tie them together. For example, I add "Bucket" to the master list with ID of 12 and then red bucket, blue bucket and green bucket are added to the details list with the MasterID being 12.
Now, my question. I have power automate sending an email when a new item is created. Sending details from the master list AND the details list. I use the filter array as shown below. The problem is that Power Automate adds in "Apply to each". So every time I add an item, I get multiple emails not only from the newest master item and subsequent detail lines, 1 email for each detail line, but also it goes through the list in a loop sending me emails for every record where the MasterID = ID.
How can I stop the loop and just have 1 email with master and detail items when an item is created? I hope this makes sense. Let me know if further details are needed. Thank you in advance.