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

Issue When Trying to Send an Email to Staff Using a SharePoint List as a Routing Table

I'm trying to use Flow to send an email to staff members if when the user filling out the form, indicated their department.  

 

List 1:  Ideas (contains the submitted forms from users with an Affected Department field)

List 2: Routing (contains the list of departments (Title) and the list of contacts for each department (Contact)

 

Error:

InvalidTemplate. Unable to process template language expressions in action 'Send_an_email_(V2)_2' inputs at line '1' and column '2707': 'The template language expression 'items('Apply_to_each')?['Contact']?['Email']' cannot be evaluated because property 'Email' cannot be selected. Array elements can only be selected using an integer index. Please see https://aka.ms/logicexpressions for usage details.'.

 

Workflow Details

I'm using Get Items to get the list of departments and contacts from the Routing list in SharePoint (List 2)

Get Items.JPG

Then I'm using a Send an email (V2) after a condition to send an email to each contact for that department.

Conditional Email.JPG

What am I missing?

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Dual Super User
Dual Super User

Re: Issue When Trying to Send an Email to Staff Using a SharePoint List as a Routing Table

Hi @chasquad 

 

Your Contact column is a multi select people picker column

hence you will need a double for loop

 

this will send individual emails to every contact

 

Capture.PNG

 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

View solution in original post

11 REPLIES 11
Dual Super User
Dual Super User

Re: Issue When Trying to Send an Email to Staff Using a SharePoint List as a Routing Table

Hi @chasquad 

 

where are you using 'items('Apply_to_each')?['Contact']?['Email']'  in your Flow

where is the error? can you share screenshot of Flow run with the error

 

'items('Apply_to_each')?['Contact']?['Email']'  

 

Contact itself might be a multi peoplepicker field

hence running 'items('Apply_to_each')?['Contact']?['Email']'  will run in error

 

you will have to also loop through your contatcs to generate the email id list

 

example Loop

'items('Apply_to_each')?['Contact']

 

within loop item()?['Email']  will give you the individual email

 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

chasquad
Level: Powered On

Re: Issue When Trying to Send an Email to Staff Using a SharePoint List as a Routing Table

I'm not a programmer, and just trying to get this task completed.  We don't use Flow very often, so please understand my ignorance in this regard.

 

Here is a flow run with error.  The error is only at the end of the flow.  The Get Items section does not have an error.

 

Flow error.JPG

Dual Super User
Dual Super User

Re: Issue When Trying to Send an Email to Staff Using a SharePoint List as a Routing Table

Hi @chasquad 

 

screenshot of flow in edit mode please

and the send email V2 action expanded (you can make sure u hide information if confidential)

chasquad
Level: Powered On

Re: Issue When Trying to Send an Email to Staff Using a SharePoint List as a Routing Table

Here is the entire workflow in edit mode.  Thanks!

FS4.JPGFS1.JPGFS2.JPGFS3.JPG

Dual Super User
Dual Super User

Re: Issue When Trying to Send an Email to Staff Using a SharePoint List as a Routing Table

Hi @chasquad 

 

Your Contact column is a multi select people picker column

hence you will need a double for loop

 

this will send individual emails to every contact

 

Capture.PNG

 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

View solution in original post

chasquad
Level: Powered On

Re: Issue When Trying to Send an Email to Staff Using a SharePoint List as a Routing Table

I hope that I did it right.  Here is what I did:

FSA.JPG

chasquad
Level: Powered On

Re: Issue When Trying to Send an Email to Staff Using a SharePoint List as a Routing Table

I get this error:

FSB.JPG

Dual Super User
Dual Super User

Re: Issue When Trying to Send an Email to Staff Using a SharePoint List as a Routing Table

@chasquad 

 

do a test run

chasquad
Level: Powered On

Re: Issue When Trying to Send an Email to Staff Using a SharePoint List as a Routing Table

Thanks.  The test run was not successful.

 

FSB.JPG

Dual Super User
Dual Super User

Re: Issue When Trying to Send an Email to Staff Using a SharePoint List as a Routing Table

@chasquad 

 

remove contact.email in your second for loop

 

and re-add it from dynamic content

 

 

chasquad
Level: Powered On

Re: Issue When Trying to Send an Email to Staff Using a SharePoint List as a Routing Table

Wow!  Perfect!  That fixed it.  Thanks so VERY much!

Helpful resources

Announcements
firstImage

Better Together Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

firstImage

Incoming: New and improved badges!

Look out for new contribution recognition badges coming SOON!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

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

sixthImage

Community Summit North America

The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (8,897)