Skip to main content

Notifications

Microsoft Dynamics CRM forum
Suggested answer

Ways to refer Javascript Libraries in CRM Portal

Posted on by Microsoft Employee

Hi all,

I did check all the options available on the CRM portal for this and couldn't find it. Need help on this!

What is the way to reference the javascript files in CRM Portal

1. Javascript from CRM Instance

2. Javascript files from external sources like (CDN libraries, external links etc..)

  • Mohammed Fakhri Profile Picture
    Mohammed Fakhri 402 on at
    RE: Ways to refer Javascript Libraries in CRM Portal

    Thanks Aric. This Worked for me.

  • Suggested answer
    Nicholas Hayduk Profile Picture
    Nicholas Hayduk 2,863 on at
    RE: Ways to refer Javascript Libraries in CRM Portal

    Hi Sreedhar,

    As Aric mentioned, if you want to include JavaScript from your CRM instance, you need to upload as a web file.  You can't easily include JavaScript that is uploaded as a Web Resource.

    As far as actually including the reference, I thought I'd mention a few additional options, in addition to the "Tracking Code" snippet.  The Tracking Code snippet was originally meant for including javascript code for things such as Google Analytics, but it can be used as Aric described, to include JavaScript for external sources, or web files.  Whatever you put in that snippet will appear near the closing body tag on all pages.

    If you need to include JavaScript higher up on the page (which is necessary if you're including libraries that you reference directly in some of the custom javascript areas in entity lists, forms, etc which are placed within the main content of the page), there is another snippet called "Head/Bottom" which will put it within the <head> tags.

    You can also include scripts via the Header or Footer "Web Templates", which appear on all pages, except if you've specifically excluded them from the page template.

    Hope that helps.

  • Aric Levin Profile Picture
    Aric Levin 30,184 on at
    RE: Ways to refer Javascript Libraries in CRM Portal

    I am not sure about external sources like CDN libraries, but for local files you will need to do the following steps:

    - Create a web file for your JavaScript, and upload the note for it. If you are not able to upload the JavaScript file for any reason it is likely that the extension is blocked from being uploaded. You will then need to go to System Settings, and remove the .js from the list of blocked extensions.

    - In Content Snippets, create a new content snippet called Tracking Code, which will be included in the master page of the site. Add the script tag to the Tracking Code content snippet in the following way:

    <script type="text/javascript" src="/internal.js" />

    Hope this helps.

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Ways to refer Javascript Libraries in CRM Portal

    Hi Sreedhar,

    please refer to the following resources:

    https://community.dynamics.com/crm/f/117/t/218907  <-- scroll to the first posted screenshot

    https://community.adxstudio.com/products/adxstudio-portals/documentation/configuration-guide/web-forms/web-form-steps/custom-javascript/ 

    https://rajeevpentyala.com/2016/09/12/useful-jscript-syntaxes-adx-portal/ 

    https://nishantrana.me/2017/02/14/using-custom-javascript-field-on-entity-form-to-add-javascript-in-portal-in-dynamics-365/ 

    http://www.toplinestrategies.com/blogs/application-development/adx-portal-dynamic-behaviors-entity-forms 

    Please let me know if you solve.

    Looking forward to hearing from you.

    If you found the answer helpful, please mark as Verified 

    Join my network on LinkedIn      Follow me on Twitter 

    Thank You & Best Regards

    Francesco Picchi

    Microsoft Dynamics CRM Consultant, Bologna+Milano, ITALY

    Independent Contractor

    http://www.francescopicchi.com

Helpful resources

Quick Links

Take the Community feedback survey!

Answer this brief 15-question survey about your Community experience…

Demystifying Copilot: Service Edition with Sundar Raghavan

Sundar answers more questions about Copilot for Service...

Dynamics 365 Business Central vs Finance and SCM

Take a look at the key differences between Business Central and…

Leaderboard

#1
Andre Arnaud de Calavon Profile Picture

Andre Arnaud de Cal... 283,377 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 223,308 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,140

Featured topics

Product updates

Dynamics 365 release plans