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 / Environment variables ...
Power Apps
Answered

Environment variables with Patch

(0) ShareShare
ReportReport
Posted on by 1,257 Super User 2024 Season 1

I used environment variables all the time so dev list in dev environment and real list in prod works great when using pipelines to move app through environments. However upto now I have only been using them with forms so I put the form datasource as the dev list.  However If I want to use them with Patch do I do the same thing ?  use the mydevlistname in the patch statement?

 


Patch(
 mydevlist
 Defaults(mydevlist), 
 {
 Title: "New Record Title", 
 Description: "Description of the new record", 
 }
)

 

 

Categories:
I have the same question (0)
  • realwillwright Profile Picture
    772 Moderator on at

    Hi,

     

    Is this through SharePoint? Using environment variables in the solution will help. see link Use environment variables in solutions - Power Apps | Microsoft Learn

    You need to create a data source environment variable for the site and one for the list.

    Then when you add in the SharePoint list in the app, you will click through add data source and when choosing a site, select advanced and pick your environment variable name.

    realwillwright_0-1707393299841.png



    -------------------------------------------------------------------
    If I have answered your question, please mark your post as Solved.
    If you like my response, please give it a Thumbs Up.

  • vffdd Profile Picture
    1,257 Super User 2024 Season 1 on at

    Thanks @realwillwright  Yes it's with sharepoint and I already use them with PowerApp forms as you have described but my question is do they work the same if I'm using Patch?  do I still reference the dev list in the Patch statement? with forms it's easy I pick the dev list as the data source but Patch it's an actual writting statement in a buttton so that's why I was wondering?

     

    thanks

  • Verified answer
    realwillwright Profile Picture
    772 Moderator on at

    Hi,

     

    Yes you would still reference the data source in the patch statement. When you move it to the net environment you would update the variable and the same data source in the app would be pointing to a different list 🙂

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 March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 530

#2
WarrenBelz Profile Picture

WarrenBelz 459 Most Valuable Professional

#3
Haque Profile Picture

Haque 314

Last 30 days Overall leaderboard