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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Automate
Answered

Filter Query in Flow

(0) ShareShare
ReportReport
Posted on by 77

Hello Dear People!

Please may I ask for your help...I have a PowerApp that writes info to a SP List with the same 'Master ID' (I created that column).

I'm trying to build a flow that when a new item(s) created in SP, all the items with the same Master ID are sent in an email.

So far I'm using Create HTML Table and its almost there; the problem is that I get an email for each item (so if there are 3 items with the same Master ID, I get three emails) and when a new item is added, I get emails for all items in the list, not just the new ones.

 

Below are images of how the data looks in SP and my current flow; I'm pretty sure that the answer lies in the Filter Query...any help would be massively appreciated 🙂

marney_0-1626371985287.png

 

marney_2-1626372168416.png

 

Categories:
I have the same question (0)
  • Ellis Karim Profile Picture
    11,995 Super User 2026 Season 1 on at

    If I have understood your problem correctly:

    1. You can use an ODATA query to find records in the SharePoint List that have the same MasterID as the newly created SharePoint item. Note the format of the ODATA query and the use of single quotes for the item's master ID. Your filter query may look something like this:

    ekarim2020_2-1626378085225.png

    (2) You will want to return at least 2 records that match the Master ID. If the Master ID entered for the newly created item is 17, then one item record with Master ID = 17 will belong to the the newly created item, and the other item record with Master ID = 17 will belong to an already existing item record in SharePoint.

    An expression similar to the one below give you how many record items were returned.

     

    length(outputs('Get_items')?['body/value']

     

    Length > 0 means at least 1 record was returned

    ekarim2020_1-1626377976236.png

    Hope this helps.

    Ellis


     

     

  • marney Profile Picture
    77 on at

    Thank you for taking the time to reply Ellis!

    The first bit works great, I am now getting an email with all the records that have the same Master ID.

    Only problem now is that I'm getting one email per record..so if there are three records with the same Master ID, I'm getting three emails (with the exact same content):

     

    marney_0-1626382201161.png

    The above have the same Master ID...but I got three emails.

     

    Thanks again mate

  • Ellis Karim Profile Picture
    11,995 Super User 2026 Season 1 on at

    Can you share the screenshots of the flow.

    I suspect that this is being caused by an Apply to Each loop iterating over each of the records returned by the query.

    Ellis

  • Ellis Karim Profile Picture
    11,995 Super User 2026 Season 1 on at

    And for quick test, set the Top Count to 1 to see if this option will work for your needs.

    ekarim2020_0-1626382842505.png

    Ellis

  • marney Profile Picture
    77 on at

    Sure mate, please see below:

    marney_0-1626384273481.png

    The only Apply to Each is after the Get Items and is there to get a few other fields from SP (I tried without that control and same result).

    I've I put 1 in Top Count, it sends me 1 email but with only 1 record inside it:

     

    marney_1-1626384386829.png

    Cheers!

  • eric-cheng Profile Picture
    5,171 on at

    Hi @marney ,

     

    I tried the below and it sends one email.  Filter match against the Title column.

     

    ericcheng_2-1626419788332.png

     

     

    ericcheng_0-1626419745315.png

     

    ericcheng_1-1626419758283.png

    --------------------------------------------------------------------------
    If I have answered your question, please mark my post as a solution
    If you have found my response helpful, please give it a thumbs up

     

  • marney Profile Picture
    77 on at

    Thanks for chipping in Eric, I still get the same result...1 email per entry with the same Master ID; I tried setting it manually (MasterID eq '24'), same result.

  • Verified answer
    marney Profile Picture
    77 on at

    Figured it out!

    Removed everything from the Body of the email except Output and only one email was sent.

    I then added all the other fields I want from the SP list into the body but from Dynamic Content, selected them from "When an item is created" and not "Get Items" like I did originally:

     

    marney_0-1626471785150.png

     

    Thanks for your efforts gents, greatly appreciated.

     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 605

#2
Valantis Profile Picture

Valantis 340

#3
11manish Profile Picture

11manish 284

Last 30 days Overall leaderboard