cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Advocate II
Advocate II

PowerApps Portal: Storing JavaScripts in web files

Hello Community,

 

I would like to get feedback and suggestions if using web files to store JavaScripts, so that we can easily re-apply the same JavaScript files to other web pages on the portal, is the right approach.

 

Basically, instead of putting the JavaScript directly on the web page itself, is the use of web files the right approach to do this? Or is there another suggested approach?

 

Please advise.

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Solution Supplier
Solution Supplier

Re: PowerApps Portal: Storing JavaScripts in web files

Hi @D365_Eric,

This is a personal/project preference - do what works best for your team. As can be identified with my drastic preference difference from @UlrikkeAkerbæk, there is no true standard.

At a high level, I prefer to use Web Files - your code can easily live in source control, team members can use Admin Web Roles to upload the files directly in the Portal without CDS access, you can use liquid tags to control which files to upload and when - e.g. you can add a param for a script name for admins to test functionality, and then add the param to script tags, such as 

{% assign is_admin = user | has_role: 'Administrators' %}
{% if params.useFile and is_admin %}
  <script src="{{ params.fileName }}.js">
{% endif %}

I wrote a small tips document on this a few years ago and decided to host it on my site, if you want to check out a table with my pros & cons.

https://justinburch.com/powerapps-portal-development-tips/where-to-code/

View solution in original post

3 REPLIES 3
Highlighted
Advocate I
Advocate I

Re: PowerApps Portal: Storing JavaScripts in web files

Hey @D365_Eric.

 

I put small global script functions in a global web template, and this web template is included in the website's footer web template. This way I only have one place to manage all the small functions. Even if you need to have three exact copies of the same web template it wouldn't be that hard to maintain if you use this approach across websites. 

 

UlrikkeAkerbæk_0-1600277224114.png

 

Libraries and bigger features are stored in js-files in Azure Blob Storage and added to the website the same way I include bootstrap and font awesome-libraries. 

UlrikkeAkerbæk_1-1600277418378.png

 

In addition I put script on the Entity Forms directly. Everyone on the team are restricted to keep scripts in one of these three locations and it works fine for us. Some small exceptions that are well documented and not business critical - mostly for design purposes and enhancing usability.

 

That's what I do for the most part. Looking forward to see what others do! 

 

Thank you for a great question! 

Highlighted
Solution Supplier
Solution Supplier

Re: PowerApps Portal: Storing JavaScripts in web files

Hi @D365_Eric,

This is a personal/project preference - do what works best for your team. As can be identified with my drastic preference difference from @UlrikkeAkerbæk, there is no true standard.

At a high level, I prefer to use Web Files - your code can easily live in source control, team members can use Admin Web Roles to upload the files directly in the Portal without CDS access, you can use liquid tags to control which files to upload and when - e.g. you can add a param for a script name for admins to test functionality, and then add the param to script tags, such as 

{% assign is_admin = user | has_role: 'Administrators' %}
{% if params.useFile and is_admin %}
  <script src="{{ params.fileName }}.js">
{% endif %}

I wrote a small tips document on this a few years ago and decided to host it on my site, if you want to check out a table with my pros & cons.

https://justinburch.com/powerapps-portal-development-tips/where-to-code/

View solution in original post

Highlighted
Advocate II
Advocate II

Re: PowerApps Portal: Storing JavaScripts in web files

Thank you @UlrikkeAkerbæk  and @justinburch  for your suggestions above!

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Find your favorite faces from the community presenting at the Power Platform Community Conference!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Users online (6,260)