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?
Solved! Go to Solution.
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:
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.
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.
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:
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
Learn to digitize and optimize business processes and connect all your applications to share data in real time.
User | Count |
---|---|
28 | |
26 | |
23 | |
17 | |
10 |
User | Count |
---|---|
58 | |
56 | |
29 | |
27 | |
24 |