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 Platform Community / Forums / Power Automate / Get data from 2 lists ...
Power Automate
Unanswered

Get data from 2 lists using one column to filter it

(0) ShareShare
ReportReport
Posted on by 10

Hi there, I appreciate your interest in my request.

 

I'm trying to build a flow which gets info from 2 lists on SP. Let's call them "Employee" and "Projects"

 

So, in 'Employee' we have all the info related to the employee, including name, contact, etc. In the other form, 'Project' we got other details which aren't in the first.

 

The goal is to send an email (notification) when a new item is created in 'Project' (sending the info in this form) plus the data related to the same person from 'Project'.

 

I was trying to filter it as ODATA somehow and later using Filter array, getting the items but I'm getting lost. Any ideas?

Categories:
I have the same question (0)
  • v-yetonggu-msft Profile Picture
    Microsoft Employee on at

    Hi @darkknightRises ,

    If possible, could you please post screenshots of the two lists? (Private information can be coded).

    Can you describe your needs in detail? For example, when you create a new item in 'Projects' list, which column do you want to associate to the 'Employee' list, and then what information in the 'Employee' list do you want to send?

     

    Best Regards,

    Sunshine Gu

  • creativeopinion Profile Picture
    10,508 Moderator on at

    @darkknightRises

    Manual Trigger

    I'm assuming your flow is going to be triggered using the When a New Item is Created trigger. However, for now, while you are building and testing your flow. Use a manual trigger. You can replace it with the Automated trigger once you've confirmed your flow works and you are ready to go live. A manual trigger will make easy to trigger your flow and run tests. Personally, I like to always keep a copy of a Manually triggered flow so I can run additional tests (in the future—should I want to edit the flow) and troubleshoot should I need to. 

     creativeopinion_0-1713494309124.png

    Add a Get Item action and select the SP Site and List name of your Projects list. Insert an ID of an existing project in your list to use for testing.

    In my Client Tracker list—I'm going to use the Assigned To user's email address to look up the employee in my Employee Tracker list.

     creativeopinion_2-1713494686314.png

    The Assigned To column is a person column. Add a Compose action to store the Email address or whichever value you are using in your case to look up the item in the other SP list. This can help with troubleshooting. 

    creativeopinion_3-1713494788977.png

     

     

    Get Employee Info

    Add a Get Items action to get your Employee list. Tip It's best practice to add a Filter Query (when possible) to reduce the overall items returned. This is especially important if you have a large list.

     

    You will need to use the internal column name of the column storing the value that you'll be using to look up the employee by. Keep in mind that the internal column name may not always match the name displayed in your Sharepoint list. If you aren't sure how to get the Internal Column name, you can refer to this section of one of my YT Tutorials.

     

    Not sure how to write a filter query? Check out this YT Short.

     

    In my Employee Tracker I also have a person column (Profile).

     

    creativeopinion_4-1713494876703.png

     

    Add a filter query. If you are using a person column like I am, you'll need to add a forward slash to your internal column name and EMail to look up the email address.

     

    [InternalColumnName]/EMail eq '[LookUp Dynamic Content]'

     

    creativeopinion_5-1713494910515.png 

    Return Item Count

    Whenever I use a Filter Query in a Get Items action, I always like to return the count of items returned in a Compose action. This is helpful when building a flow and can also be used to troubleshoot your flow.

    Insert a Compose action. Add an Expression. Use the length() function.

     creativeopinion_6-1713495024328.png

    Select the Dynamic content tab and insert the value dynamic content from the Get Items action into the length() function.

     creativeopinion_7-1713495036078.png

     

    Run a test. Review the output of the Compose action.

     creativeopinion_9-1713495260062.png

     

    Condition Check (optional)

    If there is a chance that the Get Items action doesn't return any items, to prevent your flow from failing—add a Condition action.

    If items have returned (aka there is number stored in the Compose action—that is not equal to 0), add the rest of your actions to the Yes branch. If not, do nothing.

    creativeopinion_10-1713495337850.png

     

    Send an Email (V2)

    Whenever using a Send an Email (V2) action in my flows—I always insert my email address into the recipient field while testing. I will either insert dynamic content of the actual recipient into the Subject Line and/or body of the email.

     

    Be aware of which action you are inserting dynamic content from. 

    creativeopinion_11-1713495484022.png

    Also, depending on the type of dynamic content you enter into your Send an Email (V2) action—Power Automate may automatically add an Apply to Each action. This will happen if you insert any content from the Get Items action (the Employee SP List).

     

    This is because the Get Items action will always return an array of items—even if it's a single item. To avoid the Apply to Each action (because it's not necessary) you'll need to use expressions to return your dynamic content. I cover how to do this in this YT Tutorial: 3 Mistakes YOU 🫵 are Making with the Apply to Each Action in your Microsoft Power Automate Flow

     

    In this video tutorial I’ll go over how to avoid these common mistakes when using the Apply to Each action in a Power Automate flow:

    1️⃣ Looping through a Single Item

    2️⃣ Creating Unnecessary Nested Loops

    3️⃣ Looping through an Unfiltered Array

     

    At the end of the video I share a few helpful insights when it comes to using the Apply to Each action in your flow.

     

    IN THIS VIDEO:

     How to avoid the Apply to Each action with a single item array

     How to use the item() function to access dynamic content in an array

     How to prevent unnecessary nested Apply to Each action loops

     How to use the Select action

     How to convert an array to a string with the Select action

    How to use the Filter Query field

     How to count the number of items in an array

     How to use a condition control

     How to use the concurrency control

     How to set a top count

     How to use Compose actions for troubleshooting

     

    Hope this helps!

    If I helped you solve your problem—please mark my post as a solution .
    Consider giving me a 👍 if you liked my response!

    👉 Level up your Power Automate skills by checking out my tutorials on YouTube
    👉 Tips and Tricks on TikTok and Instagram

     

     

     

     

     

     

     

     

     

  • darkknightRises Profile Picture
    10 on at

    Sure thing,

    -My needs in detail are:

    When a new item (project list) is created for an employee, I need to get data from the Project + Employee list.

    As E.G.:

    We added John Doe to Projects, and now an email with Project info and John's details from the Employee list (where we have many employee details) will be sent to a group of people.

    -Which column do you want?

    The only columns in common are First Name and Sure Name, so I want to grab those to associate with the Employee's list.

    -What information do you want?

    Everything, actually, but for different people and departments, which I plan to filter when sending email v2. I can send them just what they need.

     

    Screenshots below:

    Project listProject list

     

     

    Employee list

    2024-04-22_12h55_52.png

    Thanks a lot for your assistance on that,

    Eduardo

  • darkknightRises Profile Picture
    10 on at

    Hi @creativeopinion , what a coincidence because yesterday I was looking for ways to solve it and found your channel, and watched a bunch of them, well done for your great content and for help others like me.

     

    About your reply, I started a new flow from scratch following your guidance as described, and almost everything worked.

     

    Almost because in the step when you set the "Filter query" your suggestion unfortunately can't be applied in my case, as I need to use First Name and Last Name, internal column names are  'Nameofcontractor' and 'LastName'. I can't use only one, like First Name only or Sure Name, because it won't get the specific employee, as you probably can imagine.

    2024-04-22_14h24_51.png

    *above is what I tried, but it didn't work as below.

    2024-04-22_14h30_02.png

    *I tried to add a space between both internal names, but no joy, thoughts?

     

    Send an Email (V2)

    I usually test that by adding in the To: field the "Created by email address", but thanks for your suggestions.

     

    You earned a new subscription to your channel, all the best.

  • darkknightRises Profile Picture
    10 on at

    To give more information, I'm adding below my test flow as suggested by @creativeopinion 

     

    2024-04-22_15h03_30.png

     

  • creativeopinion Profile Picture
    10,508 Moderator on at

    @darkknightRises Thanks for subscribing and for the feedback!

     

    Unfortunately this Filter Query will not work. You need to filter on a single column at once. 

    creativeopinion_0-1713796814668.png

     

    It would look something like this.

    FirstNameColumnInternalName eq 'first name dynamic content' and LastNameColumnInternalName eq 'last name dynamic content'

     

    You will need to use the internal column name of your first name and last name columns. Keep in mind that the internal column name may not always match the name displayed in your Sharepoint list. If you aren't sure how to get the Internal Column name, you can refer to this section of one of my YT Tutorials.

    Not sure how to write a filter query? Check out this YT short.

     

    Hope this helps!

    If I helped you solve your problem—please mark my post as a solution .
    Consider giving me a 👍 if you liked my response!

    👉 Level up your Power Automate skills by checking out my tutorials on YouTube
    👉 Tips and Tricks on TikTok and Instagram
  • darkknightRises Profile Picture
    10 on at

    @creativeopinion 

     

    Thanks again for your help!

     

    "Unfortunately this Filter Query will not work. You need to filter on a single column at once."

     

    - Yes, I was looking into that after posting and changed the way you suggested, seems the flow runs but I got an error suggesting the name (columns) wasn't found.

    darkknightRises_0-1714097877155.png

    Also, as you mentioned twice about the internal column, I double-checked that and they're correct.

     

    Employee FORM

    FirstName = Nameofcontractor

    LastName = LastName

     

    Project FORM

    FirstName = EmployeeFullName

    LastName = LastName

     

    I also tried changing the sequence as get item from Project and Get Items from Employee to see if it works, below latest settings.

    2024-04-26_14h22_19.png

     

    Some quick questions about one of your suggestions.

    The "Get item" has a mandatory ID field. My questions are, will that get the next IDs and move on when a new employee is added to the Project? Or was it just for a test purpose?

     

    Thanks again, much appreciate your help.

  • creativeopinion Profile Picture
    10,508 Moderator on at

    @darkknightRises 

    This error would indicate that you made an error with your filter query.

    creativeopinion_1-1714099514516.png

     

    I would imagine when you received this error ... that your filter query looked something like this:

    'first name dynamic content' eq FirstNameColumnInternaName

    This would be incorrect.

     

    You are missing the single quotes around the dynamic content as indicated in my example filter query:

    FirstNameColumnInternalName eq 'first name dynamic content' and LastNameColumnInternalName eq 'last name dynamic content'

     

    creativeopinion_0-1714099463371.png

     

    After you've tested your flow, you can review the output of the Filter Query to check on the output of the dynamic content. Click on Show More (currently displaying as Show Less) to expand the Filter Query field. Review the Output.

    creativeopinion_2-1714099679473.png

    In your Filter Query you are using the eq operator. This means the Filter Query is looking for an exact match—and it is case sensitive. 

     

    I recommended using a Get Item action while building and testing your flow so that you wouldn't need to leave Power Automate to trigger your flow each time. As mentioned before:

     

    I'm assuming your flow is going to be triggered using the When a New Item is Created trigger. However, for now, while you are building and testing your flow. Use a manual trigger. You can replace it with the Automated trigger once you've confirmed your flow works and you are ready to go live. A manual trigger will make easy to trigger your flow and run tests. Personally, I like to always keep a copy of a Manually triggered flow so I can run additional tests (in the future—should I want to edit the flow) and troubleshoot should I need to. 

     

    creativeopinion_3-1714099820332.png

     

     

     

     

     

     

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 570

#2
Valantis Profile Picture

Valantis 405

#3
11manish Profile Picture

11manish 350

Last 30 days Overall leaderboard