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

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,368 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

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 Pages

#1
Jerry-IN Profile Picture

Jerry-IN 71

#2
Fubar Profile Picture

Fubar 62 Super User 2025 Season 2

#3
sannavajjala87 Profile Picture

sannavajjala87 31

Last 30 days Overall leaderboard