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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Problem with variable ...
Power Automate
Answered

Problem with variable initialized in foreach loop

(0) ShareShare
ReportReport
Posted on by 691

Hello,
When I initialize the variable "Montant_Actuel" it automatically goes into a foreach loop, and then when I save my WorkFlow it gives me an error telling me that a variable cannot be initialized in a foreach loop.
How do I remove my variable from the foreach loop?

s44_0-1640857824746.png

 

Thanks in advance !

Categories:
I have the same question (0)
  • Verified answer
    leo85 Profile Picture
    617 on at

    Hi,

    the for each loop is created, because the value, which you use to initialize the variable, comes from an object in an array.

    You can only move the initialize action outside of the loop, after you have removed the dynamic content ("montant actuel") from its value. Afterwards you can drag and drop the initialize action outside of the loop.

     

    The basic problem seems to be that your value "montant actuel" is part of an array. Is this intentional? Please post a screenshot, where get the value "montant actuel" from?

     

    Regards,

    Leo

     

    ---------------------------------------------

    If my answer solved your issue, please mark it as complete.

    If what I wrote helped you, please give it a thumbs up.

  • Hii_iii Profile Picture
    691 on at

    I solved my problem finally ! ^^

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 959

#2
Valantis Profile Picture

Valantis 872

#3
Haque Profile Picture

Haque 589

Last 30 days Overall leaderboard