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 Email Address from...
Power Automate
Answered

Get Email Address from SharePoint List based on Department

(0) ShareShare
ReportReport
Posted on by 34

I have 2 Sharepoint Lists.  

List1 - Item list with one of the columns for each item being (OwningDepartment)

List 2 - 2 Columns (Department)(DeptManager)

(OwningDepartment)(Department) have a 1 to 1 relationship theoretically but are not programed as a lookup in sharepoint.

 

When a new item is created I am trying to have flow look up the Department Manager in List2 based on what OwningDepartment is selected in List1 and send them an email.

 

Can anyone help with this???

 

Thanks

Categories:
I have the same question (0)
  • Verified answer
    m4ngo5 Profile Picture
    90 on at

    Hi @Teaners26,

     

     

    Let's see what we can do.

     

    I have my two lists.

    List 1

    List1-MakingAnItem.PNG

     

    And List 2

     

    DepartmentList-List2.PNG

     

    1. First you're going to create a trigger "When an item is created".  You're going to point this at your list 1,as you said.

      WhenAnItemIsCreated.PNG

    2. Create a "Get items" action and point it at your second list.  This is where the magic happens.  In the advanced options section, under filter query, you are going to create the filter. Your filter is going to look at items with a department value that equals the department value of the newly created item. 

      GetItemsAndFilter.PNG

      My filter query looked like this: 

      Dept_x0020_Manager eq '[Department Value]'


      There are three parts to this: 
      1. Dept_x0020_Manager - This is official name of your column in List 2 that you would like to search for a matching department name.
      2. eq - This is saying to look for things that have [value1] that equal [value2].
      3. '[Department Value]' - this returns the department value from the item that initiated the flow in List 1.  

      To find your column name (mine above was Dept_x0020_Manager), go to the list settings in List 2 and click on your "Dept Manager" column.  Then look at the end of your URL and you'll see it following "Field=".

      GoToListSettingsAndColumnSettings.PNG


      ColumnName.PNG


    3. Then create your email and fill in your variables. 

      You don't need to create the "Apply to each" piece.  It isn't necessary in this case but because our output was from a "Get items" action it could theoretically return multiple items, therefore when I created the next step, it created the "apply to each" loop.  This won't affect anything -- if there is only one item returned, it will only run once.

      SendEmailAboutNewItem.PNG

    Let me know if this helps!

     

    -Stuart

  • Verified answer
    Teaners26 Profile Picture
    34 on at

    I got this to work but i had to switch Dept_x0020_Manager with Department in the below expression.

     

    Dept_x0020_Manager eq '[Department Value]'

  • m4ngo5 Profile Picture
    90 on at

    I'm glad you got it working!  

     

     

  • m4ngo5 Profile Picture
    90 on at

    You're right about substituting Department for Department_x0020_Manager in the filter query. That was an error.

     

    I can't remember if I tested my solution -- I probably didn't.

  • zz6 Profile Picture
    2 on at

    @m4ngo5 I have a nearly identical scenario except my analagous "Department" column in List 1 is a multiple selection lookup column of the department column of List 2. I want separate emails to be sent to each designated person.

     

    I tried adding a For Each block to try to get it to run for each "Department" selected but it doesn't seem to be working

     

    Do you know if/how I can modify the method you showed to my needs?

     

    I know sharepoint isn't super friendly to lookup columns or multiple selections. 

     

    Thanks!

  • m4ngo5 Profile Picture
    90 on at

    @zz6If you still need help on this, I think I have the answer for you. 

     

    When you have a list or library with lookup columns and you want an ODATA filter query to use these lookup columns, there is a special syntax for it.  You need to type in the name of the primary lookup column, a forward slash, then the name of the project lookup column (the child column). 

     

    Here is a screenshot of one of my Flows.  The SharePoint library has a lookup column for Project Number, and a projected column for the Status which comes from the lookup against the Project Number list.  Syntax is ParentColumn/ChildColumn.

     

    FlowScreenshot.png

     

    If that's not what you're looking for, tag me and let me know!

  • walking Profile Picture
    30 on at

    Hi @m4ngo5 ,

     

    why the filter query is not :

    Department (in List2) eq '[Department Value]' (in list1)?

    Thank you.

  • m4ngo5 Profile Picture
    90 on at

    Hi @walking,

     

    I'm a little confused, but I'll do my best to answer.  It looks like you may be pointing out that I did not answer @zz6 properly, so thank you for that.  I didn't address the case of filter queries directed at the primary lookup column, I addressed only the case of filter queries directed to child lookup columns.  For the primary lookup column, the syntax is the same as the child lookup columns, except you use a forward slash with title.  The syntax for my previous example would be:

     

    ProjectNumber/title eq '[Value]'

     

    And for the department example from @zz6, it would be:

     

    Department/title eq '[Department Value]'

     

    I tested that this works against lookup columns with multiple selection enabled.  If the filtered value is contained in the lookup column, the record will be returned.

     

    You can filter for records that match both of two values in the department column by connecting two filter queries with an "and".  Likewise, an "or" substituted for "and" will filter for records that match either of two values. 

     

    Building on this, you could use a for loop to append multiple filter queries to a string variable, and insert this string variable into the filter query field. This could be used to created a dynamic filter query that returns records that match a long list of values -- perhaps values which are not known until the flow runs.

  • Dewi86 Profile Picture
    4 on at

    @m4ngo5 

     

    I'm really struggling to get my head around this. When I tried the first solution above I was told my column doesn't exist.

     

    Essentially, I have a form that when filled out plugs the data into a sharepoint list. I have already been able to create a lookup as part of this flow, that identifies the submitters region, based on their country in O365.

     

    As part of this I want an email to go to specific set of people based on region and job role. This is in another list in a matrix. Ideally, it would be good to keep the people for each region and role separate for ease of updating should someone leave or be replaced (me included).

     

    The main list (list1) looks like this in essence (many other column besides):

    list1.png

    The contact list looks as follows (List2):

    list2.png

     

    Now I am creating an additional flow that looks for a new item being created in List 1. It should then look up the region in the title column of List 2, and add send to the email addresses of each person in each job role for that region. The job roles are people or contact fields, where the flow picks up the email address from the O365 contact. In testing I've not filled out the other fields yet other than one with my own person in.

     

    My flow looks like below:

    flow1.png

    Now, when this flow is run, it fails with the message "Column NWE does not exist", and after batting my head against this for a few days, I cannot understand why...

     

    results1.png

     

    It's clearly picked something up from somewhere, but I am at a loss. I'd be very grateful for any support given by anyone!

  • m4ngo5 Profile Picture
    90 on at

    @Dewi86If I understand this correctly, when an item is created in List 1, you want to notify a list of individuals from that region that this new item has been created.  So if the item in List 1 has a region of NWE, in List 2 there is an entry for the NWE region with columns that include the people you want to email including the Regional ISSO, IT Lead, Legal Rep, etc.

     

    I'm noticing a few things that could be wrong:

    • Shouldn't Get Items be operating on List 2, not List 1?
    • You probably need single quotes around 'Region' in the filter query.
    • If Region in List 1 is a lookup column, there should be a column called 'Region Value' that you will probably need to use for your filter query instead of 'Region'

     

    Please let me know if that helps!

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
Vish WR Profile Picture

Vish WR 505

#2
Haque Profile Picture

Haque 446

#3
Valantis Profile Picture

Valantis 395

Last 30 days Overall leaderboard