Dela via


Script (JScript) web resources

 

Applies To: Dynamics 365 (online), Dynamics 365 (on-premises), Dynamics CRM 2016, Dynamics CRM Online

Use Script (JavaScript) web resources to create a library of JavaScript functions that can be accessed from anywhere.

In This Topic

Capabilities of script web resources

Limitations of script web resources

Using JavaScript libraries

Referencing a script web resource from a webpage web resource

Capabilities of script web resources

With Script web resources, you can more efficiently manage code used in form scripts, webpage (HTML) web resources, or ribbon commands by linking them to shared library of JavaScript functions.

Limitations of script web resources

Like all web resources, script web resources use the Microsoft Dynamics 365 web application security context. Only licensed Microsoft Dynamics 365 users who have the necessary privileges can access them.

Note

References included in code between web resources aren’t tracked as solution dependencies.

Using JavaScript libraries

For information about developing and testing JavaScript libraries as well as how to associate them with ribbon commands and form events, see JavaScript libraries for Microsoft Dynamics 365.

Referencing a script web resource from a webpage web resource

All web resources can use relative URLs to reference each other. In the following example, for the webpage web resource new_/content/contentpage.htm to reference the script web resource new_/scripts/myScript.js, add the following HTML code to the head element of new_/content/contentpage.htm.

<script type="text/jscript" src="../scripts/myScript.js"></script>

To reference a script from a different publisher, the path must include the customization prefix for that publisher. For example, for the new_/content/contentpage.htm page to reference the MyIsv_/scripts/customscripts.js page, the src attribute value should be ../../MyIsv_/scripts/customscripts.js.

See Also

Use JavaScript with Microsoft Dynamics 365
JavaScript libraries for Microsoft Dynamics 365
Web resources for Microsoft Dynamics 365
Webpage (HTML) web resources
CSS web resources
Data (XML) Web resources
Image (JPG, PNG, GIF, ICO) web resources
Silverlight (XAP) web resources
Stylesheet (XSL) web resources

Microsoft Dynamics 365

© 2016 Microsoft. All rights reserved. Copyright