cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
megbert
Level: Powered On

Send email using contacts list based on another list value

Greettings,

I am new to Flow and been able to figure some things out but have gotten stuck and hoping someone can direct me in the right direction.

List_A has the following fields "Dept, Manager, Supervisor, DirectReport1, DirectReport2". 

In List_B I have a field called "Dept".

I need to be able to get the contacts from List_A and send an email whenever a new item is created in List_B based on what Dept is entered into List_B.

Any assistance would be appreciated.

2 ACCEPTED SOLUTIONS

Accepted Solutions
Super User
Super User

Re: Send email using contacts list based on another list value

One quick question - are you using List A as a deprtmant lookup for list B?

 

Scott

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

View solution in original post

megbert
Level: Powered On

Re: Send email using contacts list based on another list value

I changed the column type to person and it works!!

 

Thank you!

View solution in original post

13 REPLIES 13
Super User
Super User

Re: Send email using contacts list based on another list value

One quick question - are you using List A as a deprtmant lookup for list B?

 

Scott

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

View solution in original post

megbert
Level: Powered On

Re: Send email using contacts list based on another list value

 

Damm - Hit the wrong button.

 

No.  They are just 2 standalone lists.

Super User
Super User

Re: Send email using contacts list based on another list value

I can create a simple solution for you but it would be a much better idea to create a lookup form list B that gets the Dept from list A.  What do you want to do?  Keep as is or use a lookup?

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott
megbert
Level: Powered On

Re: Send email using contacts list based on another list value

Since it is used by several lists I would like to keep as is.

It is also used in a list that is updated by an InfoPath form that I will eventually convert to PowerApps so I don't want to make any changes to the list that may break something else.

Super User
Super User

Re: Send email using contacts list based on another list value

@megbert-  Here is a solution that should work for you:

I have 2 lists - ListA and ListB

In ListA I have fields for Title (used for Dept), Manager, Supervisor, Direct Report1 and DirectReport2.  All Columns except for Title are Person or Group columns

In List B, I have the Title column and an Option Column.  The Option choices are the departments (Dept1, Dept2, etc.)

 

When a new item is created, I use a Get Items to retrieve the appropriate matching row from listA - see the OData filter syntax.

Since there can techically be more than one item returned (but there won't since each dept is in list A only once) I go into a loop.  Inside the loop, I can access the emails of the Manager, Supervisor, etc. and send an email.

 

I have tested this Flow and it works without error.

 

ListAListB.png 

 

Scott

 

 

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott
megbert
Level: Powered On

Re: Send email using contacts list based on another list value

Received an error:

ActionConditionFailed. The execution of template action 'Apply_to_each' is skipped: the 'runAfter' condition for action 'Get_items' is not satisfied. Expected status values 'Succeeded' and actual value 'Failed'.
Super User
Super User

Re: Send email using contacts list based on another list value

Please post a screen shot of your Flow so that I can assist.

 

Scott

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott
megbert
Level: Powered On

Re: Send email using contacts list based on another list value

Ok not the same tables we were talking about but the same principle. Moved away from using production data for now.

 

Sceenshot1.jpgSceenshot2.jpg

Super User
Super User

Re: Send email using contacts list based on another list value

I suspect that Flow doesn't like your OData filter.

First, put single quotes around the RegionOwners column that you selected from dynamic properties.  In the screen shot that I included above, look at the OData filter and the single quotes around Dept Value.

 

If tthat doesn't fix the issue, can you tell me the data type of the RegionOwners... column?

 

Scott

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott
megbert
Level: Powered On

Re: Send email using contacts list based on another list value

The fields are string data.  Shoud the contacts be stored in the list as the actual email address?

Super User
Super User

Re: Send email using contacts list based on another list value

 

Using a person or group columns is OK - even preferrable.  The issue is with the filter.

 

Did you put the single quotes around the coulmn name and test?

 

Scott

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott
megbert
Level: Powered On

Re: Send email using contacts list based on another list value

Yes I put quotes around column.  It's failing on the email.

 


  "status"400,
  "message""One or more recipients are invalid.\r\nclientRequestId: ef364c7c-8dea-4b82-b61c-7b1265b89e74\r\nserviceRequestId: 3a576f5b-d246-4433-9713-ad6da6a21cf6",
  "source""office365-scus.azconn-scus.p.azurewebsites.net"
}

 

The contact colums are just Single Line of Text columns.

megbert
Level: Powered On

Re: Send email using contacts list based on another list value

I changed the column type to person and it works!!

 

Thank you!

View solution in original post

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (5,591)