cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
KoenMarien
New Member

the result of the evaluation of 'foreach' expression '@items('Apply_to_each_2')?['Datum_x002f_Date']' is of type 'String'. The result must be a valid array.

Hi all

 

My first time building a flow. I have a Sharepoint list with dates (column (type 'Date and time') 'Datum/Date 2022' on page 'Themadagen Ziekten'). Now I want an email sent 14 days before a date in the list.

 

I tried building a 'scheduled cloud flow' based on https://powerusers.microsoft.com/t5/Building-Power-Apps/Sending-an-email-on-a-certain-sharepoint-lis... but it keeps failing...

 

Get Items is configured with the Site Address and List Name ('Themadagen Ziekten').

Next I have a nested 'Apply to each'. The mother 'Apply to each 2' contains just 'values'. The child 'Apply to each' contains 'Datum/Date 2022' with a condition attached to it (see powerusers link): 

if 'formatDateTime(items('Apply_to_each'),'dd.MM')' equals '
formatDateTime(utcNow(),'dd.MM')
' then send an email...
 
But I keep getting this error in one or other form: "The execution of template action 'Apply_to_each' failed: the result of the evaluation of 'foreach' expression '@items('Apply_to_each_2')?['Datum_x002f_Date']' is of type 'String'. The result must be a valid array."
 
What am I doing wrong? Please help, thanks!
1 ACCEPTED SOLUTION

Accepted Solutions
Amit_Sharma
Solution Sage
Solution Sage

@KoenMarien 

 

You Have to Enter Valid Internal Column Name After Apply to Each or Select Dynamically Where You Store Date in SharePoint List. 

Try With Extra Compose,

Amit_Sharma_0-1670594296975.png

Amit_Sharma_1-1670594346118.png

 

View solution in original post

7 REPLIES 7
Amit_Sharma
Solution Sage
Solution Sage

Hi @KoenMarien,

Enter DateTime Column Name After Apply To Each.

If 'formatDateTime(items('Apply_to_each')?['Date Column Name'],'dd.MM')' equals '
formatDateTime(utcNow(),'dd.MM')

formatDateTime(items('Apply_to_each')?['Date Column Name'],'dd.MM')' equals '
formatDateTime(utcNow(),'dd.MM')

 

Please share the flow screenshot and clarify more on requirement If I misunderstood the requirement.

 

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

KoenMarien_0-1670590391475.png

 

Amit_Sharma
Solution Sage
Solution Sage

Hi @KoenMarien,

You Have Don't Neet to Use Apply to each in flow Just Use Apply to each2Where You Enter Value.

I have Created Sample for You.

Left Side

 

formatDateTime(items('Apply_to_each')?['Datum_x002f_Date'],'dd.MM')

 

Amit_Sharma_2-1670591442653.png

 

Right Side

Amit_Sharma_1-1670591398797.png

Output

Amit_Sharma_3-1670591464141.png

 

KoenMarien
New Member

I didn't work 😞

 

KoenMarien_0-1670592314384.png

 

Amit_Sharma
Solution Sage
Solution Sage

@KoenMarien,

Please Send Me Both left and Right-Side Expression(code) That Use in Condition

 

Left Side Expression Is:

formatDateTime(items('Apply_to_each')?['Datum_x002f_Date'],'dd.MM')

Right Side Expression Is:

formatDateTime(utcNow(),'dd.MM')

 

And Please Also Check The get Item Action Return Any Value or Not 

KoenMarien_0-1670593478822.png

KoenMarien_1-1670593512824.png

 

formatDateTime(items('Apply_to_each')?['Datum/Tijd 2022'],'dd.MM')
formatDateTime(utcNow(),'dd.MM')
Amit_Sharma
Solution Sage
Solution Sage

@KoenMarien 

 

You Have to Enter Valid Internal Column Name After Apply to Each or Select Dynamically Where You Store Date in SharePoint List. 

Try With Extra Compose,

Amit_Sharma_0-1670594296975.png

Amit_Sharma_1-1670594346118.png

 

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Users online (1,678)