cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
kdillon
Regular Visitor

Email Users who were Assigned Task when Completed (Planner)

I'm trying to build a flow that automatically emails all users who were assigned a task that it was completed. 

 

The flow starts off with "When a task is completed" -> Get Task Details -> Apply To Each -> Get User Profile (Assignments) -> Send an Email V2

 

The apply to each seems to correctly pull the email addresses from the planner item but the Send An Email V2 throws the following error:

"Unable to process template language expressions in action 'Send_an_email_(V2)' inputs at line '1' and column '31334': 'The template language expression 'outputs('Get_user_profile_(V2)')?['body/mail']' cannot be evaluated because property 'body/mail' cannot be selected. Array elements can only be selected using an integer index. Please see https://aka.ms/logicexpressions for usage details.'."

 

Not sure what I'm doing wrong - can anyone help? 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

The content from 'Apply to each' doesn't make it outside of the 'Apply to each'. If you need to build a list of all approvers to send the email, you should:

  • Initialize a string variable
  • Inside 'Apply to each' after the 'Get user profiles', 'Append to string variable' the user email address with semicolon at the end, that will give you a variable with all the emails
  • 'Send an email' to that variable (outside of the 'Apply to each')


[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]

View solution in original post

6 REPLIES 6
tom_riha
Super User II
Super User II

Hello @kdillon ,

try to delete the email address dynamic content in the 'Send an email' action and enter it again, it seems it's not correct.



[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]

Thanks for the reply @tom_riha

I deleted it and now it doesn't let me repopulate it with the "mail" item I had before. The only options for dynamic content are from the planner (get task details) and "current item" from apply to each?

Then I'd try to recreate also the 'source' action for that email. There must be something broken in one of the actions in your flow. Maybe try to delete the whole 'Apply to each' and build the email sending part again.



[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]

@tom_riha 

kdillon_1-1618415998882.png


Maybe I'm doing something else wrong? I rebuilt everything after "When a task is completed". It seems like it correctly gets the tasks details, the "apply to each" loops through the "get user profile" and pulls all the data from the 4 users in my test but I can't seem to send them to the send an email part. I'm not a programmer or anything but based on what it's saying, it sounds like it stores all 4 users in an array and the email v2 doesn't understand how to pull the individual users from that array? Maybe something is supposed to be in between the apply to each and send an email?

 

The content from 'Apply to each' doesn't make it outside of the 'Apply to each'. If you need to build a list of all approvers to send the email, you should:

  • Initialize a string variable
  • Inside 'Apply to each' after the 'Get user profiles', 'Append to string variable' the user email address with semicolon at the end, that will give you a variable with all the emails
  • 'Send an email' to that variable (outside of the 'Apply to each')


[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]

View solution in original post

kdillon
Regular Visitor

@tom_riha 

 

This worked! Thank you so much

Helpful resources

Announcements
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Kudoed Authors
Users online (2,237)