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 / Dynamics 365 Portal - ...
Power Pages
Unanswered

Dynamics 365 Portal - Best Practice for JavaScript

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi All,

Thanks for reading my post.

We're doing configuration of 'Dynamics 365 Portal' for a client and we're bit confused where to maintain all of our JavaScript as per Best Practice?

 

At the moment, we have 3 viable options:-

 

  1. Option # 1: Only one 'Custom.js' web file, which has all the JavaScript of the entire portal. 
  2. Option # 2: Couple of '*.js' web files which are based on following principle:
    1. Core file - Contains functions that are used almost everywhere and other useful page things.
    2. Module files - Contains code that is used in several places, but not everywhere. 
  3. Option # 3: Write down the JavaScript in the 'Custom JavaScript' field of the Entity form / Web form.

Which approach are you guys inclined to? Or what is the Best Practice for a JavaScript based on performance & maintainability? 

 

Thanks for your time.

Categories:
I have the same question (0)
  • oliver.rodrigues Profile Picture
    9,482 Most Valuable Professional on at

    Hi

     

    What I normally go for is a hybrid of your options #2.core and #3 

     

    • My "core" JS contains common functions that I might use across the Portals 
    • Then each Entity Form/Web Form/Web Page etc would have its own JS code, but normally calling whatever is generic from the core JS

    The core JS can be a Web File or a Web Template, and you can reference it in your TrackingCode content snippet so it is available in every page

     

    ------------

    If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Pages

#1
11manish Profile Picture

11manish 50

#2
Valantis Profile Picture

Valantis 26

#3
omkarsupreme Profile Picture

omkarsupreme 24

Last 30 days Overall leaderboard