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 Apps / How can I update an en...
Power Apps
Answered

How can I update an environment variable from a flow

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi, great to see it's now easy to read an environment variable in a flow (provided the flow is created within a solution!) but how to update the value of the environment variable from within the flow?

 

I assume I will need to use the Dataverse connector's Update a Row function so I start by retrieving the environment variables UID using 'List rows' : -

1.png

This appears to work and I can reference the UID using: -

 

first(outputs('Get_SMSyncInitialise_UID')?['body/value']?[0]?['environmentvariabledefinitionid'])

 

BUT when I try and reference that UID to update the environment variable record ...

 

2.png

 ... I receive the error: - "Bad Request - Error in query syntax."

 
Stumped 😞 Any pointers please?

 

Cheers

I have the same question (0)
  • Verified answer
    EricRegnier Profile Picture
    8,720 Most Valuable Professional on at

    Hi @Anonymous,

    You're setting the row ID of the update step to "Environment Variable Definition" ID, but should be the row ID of "Environment Variable Value". In the "GetSMSSyncInialise" list row step, use the "Expand Query" to include related environment variable values. This will give you the "Environment Variable Value" ID to update. Then iterate from the rows returned and update the value within the loop.

    Hope this help! 

  • Verified answer
    Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thank you @EricRegnier for pointing me in the right direction

     

    In the end, instead of using an Expand query for List Rows I used the excellent FetchXML Builder tool (from XRMToolbox) to generate an XML Query that pulled out just the UID as follows: -

     

    <fetch>
      <entity name="environmentvariabledefinition" >
          <filter>
            <condition attribute="schemaname" operator="eq" value="hdc_SMSyncInitialise" />
          </filter>
        <link-entity name="environmentvariablevalue" from="environmentvariabledefinitionid" to="environmentvariabledefinitionid" >
          <attribute name="environmentvariablevalueid" alias="envUID" />
        </link-entity>
      </entity>
    </fetch>

     

    ... and the expression: -

    first(body('Get_Environment_Variable_UID')['value'])['envUID']
     
    ... in the Update a Row 'Row ID' field.

     

    All working 🙂

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!

Leaderboard > Power Apps

#1
wolenberg_ Profile Picture

wolenberg_ 119 Super User 2026 Season 1

#2
WarrenBelz Profile Picture

WarrenBelz 107 Most Valuable Professional

#3
Haque Profile Picture

Haque 103

Last 30 days Overall leaderboard