I am trying to create a flow that sends me a teams message/email reminder if an item on my planner is due the next day. Every time I run it, it faills with "Action 'Apply_to_each_2' failed. The execution of template action 'Apply_to_each_2' failed: the result of the evaluation of 'foreach' expression '@{outputs('List_tasks')?['body/value']}@{items('Apply_to_each_4')?['dueDateTime']}' is of type 'String'. The result must be a valid array." I know there was a template for this at one point but it appears to have been deleted.
Hi
Please post details of your filter array and the tomorrow date compose action.
It is some missing the tomorrow date as it complaints.
I was able to fix it (I think) but now I have an error in the flow checker for Filter array "Correct to include a valid reference to 'Compose_-_Tomorrow' for the input parameter(s) of action 'filter_array'.
Sorry for not being clear, it says "The expression is invalid." when trying to enter
Could you please be a bit more specific?
In which step it doesn't allow you?
What error message do you get?
You are using the "Expression" tab (next to dynamic content) for entering the formatDateTime function, right?
It won't let me use the formatDateTime function
Hi @Logannm
I would do the following.
1. List task action
2. Compose action to create tomorrows date (with some good date formating)
formatDateTime(addDays(utcNow(),1),'dd/MM/yyyy')
3. Filter the retrieved tasks to avoid task which has no due date and are equal to tomorrow date
Input: are the "value" of the list task action (dynamic content)
Filter condition is in advanced mode with code
@and(not(equals(item()?['dueDateTime'], null)),equals(formatDateTime(split(item()?['dueDateTime'],'T')[0],'dd/MM/yyyy'),outputs('Compose_-_Tomorrow')))
4. Select action to create a nice array of certain value
Input:
body('Filter_array_-_Task_Due_Date_not_equals_null')
Map:
Title | item()?['title'] |
Due Date | formatDateTime(split(item()?['dueDateTime'],'T')[0],'dd/MM/yyyy') |
UserId | item()?['_assignments']?[0]?['userId'] |
TaskId | item()?['id'] |
5. Apply to each loop to run trhoug each task to send the email/teams channel
Get User Profile
Send email
That works very fine 🙂
Final Email
Hope that brings it closer to what you want to achieve.
Please accept as solution if it will solve your challenges.
I can't fit the whole flow on screen but I believe what's in the screenshot is the problem.
Hi
I think the part of your query has not a correct reference {outputs('List_tasks')?['body/value']}@{items('Apply_to_each_4')?['dueDateTime']}. ..
Can you share the flow details?