How to access power portal site settings from an external JavaScript file

How to Access Power Portal Site Settings from an External JavaScript File

Calling Inline JavaScript in Power Portals: 

Power Portals enable you to create websites that extend your Dynamics 365 functionalities. JavaScript adds another layer of interactivity, allowing you to customize user experiences. Here’s a breakdown of how to incorporate JavaScript in different portal elements:

  1. Web Pages
  2. Basic Forms
  3. List

But some reasons lead to using External JS instead of Internal JS. External JS offers several advantages over inline JS in Power Portals. They lead to cleaner, more maintainable, and reusable code, potentially improving performance.

Calling External JavaScript from Web Files:

  1. Create the JavaScript file
  2. Upload the file to Web files
  3. Refer to the file on your web page

With these steps, the browser will automatically download and execute the JavaScript code from your external file whenever the page loads.

Securely Accessing Site Settings:

Site Setting: It functions like little storage boxes holding values that define your portal’s behavior. These values can be adjusted based on the environment the portal is running in, allowing for easy adaptation and reduced risk of errors.

Here’s an example of an external JavaScript; it is used to store HTTP request call URLs, values, logic App URLs, etc. which might change depending on the environment.

Calling Site Setting using Web File:

1.Input 

2. Output

After applying the input, here’s what the output of a power apps portal looks like.

Let's talk

Leave your details and one of our experts will contact you!

Get a free consultation

I am text block. Click edit button to change this text. Lorem ipsum dolor sit amet, consectetur