cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
neill_long
Helper V
Helper V

Apply to each issue

Hello,

 

I am receiving the following error when i run my flow:

 

The execution of template action 'Apply_to_each_4' failed: the result of the evaluation of 'foreach' expression '@triggerBody()?['AdminServices']' is of type 'Null'. The result must be a valid array.

 

I have initialize Variable type as string before it gets to this step and other variable and apply to each similar to the AdminServices which runs before hand with no issues.  It gets stuck at the adminservices section even though this field in the SP List is set up exactly the same as the previous steps.

 

This is the step that is causing the issues:

 

neill_long_0-1632145011070.png

would anyone have any advice on how i can fix this please?

 

thanks

Alistair

4 REPLIES 4
eric-cheng
Solution Sage
Solution Sage

Hi @neill_long ,

 

Looks like AdminServices is empty?  Can you add a Compose action prior to your loop and confirm the output? 

 

You can add a condition to check if empty(triggerBody()?['AdminServices']) is true or not and only loop when it is false.

 

--------------------------------------------------------------------------
If I have answered your question, please mark my post as a solution
If you have found my response helpful, please give it a thumbs up

Connect on LinkedIn

Hi @eric-cheng 

 

It is empty but I have also tested it where there was data in the field and still got the same message.

 

I put a Compose prior to it and the output was empty, but i dont understand why it worked on the step before for LearnerEngage.  This is a similar field in the same SP List and it was empty too.  

 

Would there be a setting on the field in the SP List that i am missing that it doesn't recognise it?  The error message mentions a valid array, but the initialize variable i have specified as string

 

 

eric-cheng
Solution Sage
Solution Sage

Hi @neill_long ,

 

Can you screenshot the field settings in SharePoint for both fields?

--------------------------------------------------------------------------
If I have answered your question, please mark my post as a solution
If you have found my response helpful, please give it a thumbs up

Connect on LinkedIn

neill_long
Helper V
Helper V

Hi @eric-cheng 

 

It was me being stupid, I had set the choice fields in the SP list slightly differently.  should have allowed multiple responses but hadn't selected that option.

 

thanks for your help, it's now working

Helpful resources

Announcements
2022 Release Wave 1 760x460.png

2022 Release Wave 1 Plan

Power Platform release plan for the 2022 release wave 1 describes all new features releasing from April 2022 through September 2022.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Users online (1,887)