Skip to main content

Notifications

Power Automate - General Discussion
Unanswered

Apply to each issue

(0) ShareShare
ReportReport
Posted on by 704

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

  • neill_long Profile Picture
    neill_long 704 on at
    Re: Apply to each issue

    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

  • eric-cheng Profile Picture
    eric-cheng 5,171 on at
    Re: Apply to each issue

    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 Profile Picture
    neill_long 704 on at
    Re: Apply to each issue

    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 Profile Picture
    eric-cheng 5,171 on at
    Re: Apply to each issue

    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

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,636

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,942

Leaderboard