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 Pages / How do I access an env...
Power Pages
Suggested Answer

How do I access an environment variable in javascript in Power Pages

(0) ShareShare
ReportReport
Posted on by
I want to set up a Dev-Stage-Prod setup for an app, where I send requests to an external server with the same environments. Every environment has a slightly different URL. I would like to do this with Environment Variables, since it has to be different on every environment, so site settings will not do.

I have set up a solution, that adds a `new_submit_url` ENV variable during a deployment. I have verified that the correct table entries are created in the environment variable definition and value dataverse tables. Question is, how do I access these values in the app?

I have tried `Xrm` (it's undefined), liquid entities (nothing loads), Portals Web API (also nothing loads). 

I am quite sure I'm just missing something extremely obvious, can anyone show me an example of how to extract an environment variable's value by its schema name?
Categories:
I have the same question (0)
  • Suggested answer
    oliver.rodrigues Profile Picture
    9,455 Most Valuable Professional on at
    Hi, the correct way to achieve this is to use the Site Settings in Power Pages.
     
    I am not sure how you are dealing with ALM/deployments, if using CLI you can leverage Deployment Profiles https://learn.microsoft.com/en-us/power-pages/configure/power-platform-cli#use-deployment-profile

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 Pages

#1
rezarizvii Profile Picture

rezarizvii 64

#2
DP_Prabh Profile Picture

DP_Prabh 36

#3
oliver.rodrigues Profile Picture

oliver.rodrigues 30 Most Valuable Professional

Last 30 days Overall leaderboard