web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Flow save failed with ...
Power Automate
Unanswered

Flow save failed with code 'InvalidVariableInitialization' and message 'The variable action 'Initialize_variable' of type 'InitializeVariable' cannot be nested in an action of type 'Apply_to_each'.'.

(0) ShareShare
ReportReport
Posted on by

Hi,

What does this error mean and how to solve it?

I want to get the info of a Sharepoint row and pass it back to Powerapps in order to do something with that data using Power automate.c3.PNG

Categories:
I have the same question (0)
  • annajhaveri Profile Picture
    8,531 Most Valuable Professional on at

    @Anonymous  the error says that you cant add "Initialize Variable" action inside apply to each action. So add "Initialize Variable" action before the Apply to each action, and then add "Set Variable" action inside Apply to each action, to set the value of variable.

  • Community Power Platform Member Profile Picture
    on at

    @annajhaveriI did what you suggest. It works without the respond to powerapps flow, but i need that flow to send that data to my powerapps.c4.PNG

  • annajhaveri Profile Picture
    8,531 Most Valuable Professional on at

    @Anonymous  what value you want to return in the Respond to a PowerApp or Flow?

  • Community Power Platform Member Profile Picture
    on at

    @annajhaveriI want to return data from SharePoint to PowerApps.
    A row in SharePoint has this data (id, name, surname, age, location, etc)

  • Verified answer
    annajhaveri Profile Picture
    8,531 Most Valuable Professional on at

    @Anonymous  using "Respond to a PowerApp or Flow" action you cant return an array, so i would suggest to change the type of variable to string. And instead of Set Variable use "Append to string variable" action and use concat expression to concat values of id, name surname, age, location, etc, example expression as below:

    concat(items('Apply_to_each')?['ID'],', ',items('Apply_to_each')?['Title'],', ',items('Apply_to_each')?['Name'])

     

    See how actions will be added in flow in screenshot below

    annajhaveri_0-1623244816890.png

    Are you using filter query on Get Items to get specific item from list?

  • Community Power Platform Member Profile Picture
    on at

    @annajhaveriOk, it works as you stated. I managed to build a string with a comma separator.

    Thanks

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 523 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 406 Moderator

#3
abm abm Profile Picture

abm abm 245 Most Valuable Professional

Last 30 days Overall leaderboard