Dynamics 365 CRM Development Standards - Customization 2
Overview
This is Customization part 2 of a series of blogs introducing the Development Standards and Best Practices to help configure and customize CRM to do so consistently, clearly, and meaningfully.
Table of Contents
JavaScript
Introduction
D365 offers numerous OOB(Out-of-Box) features to meet custom requirements from the front end. For example, Business Rules, Roll-up fields, Calculated fields, and Process Flows.
However, in certain scenarios where you can’t get what you need from the OOB, then
JavaScript is a powerful tool to meet specific requirements.
Best Practices
- As a best practice, you should always define a unique namespace for your libraries to avoid having your functions overridden by functions in another library.
var Example = window.Example || {};
- Group custom scripts related to an entity as opposed to global scripts, together in a single file or a series of related files and store them as a web resource.
- Bind <On Save> and field <On Change> events in the <On load> event, then we can see all events in one JS file.
formContext.getAttribute(arg).addOnChange(myFunction) formContext.getAttribute(arg).addOnSave(myFunction)
4. Use session storage items to cache configuration data to avoid duplicate retrieve calls.
5. Avoid using synchronous data access methods, use asynchronous methods instead.
Not Recommended
- Don’t use getElementXX() to access the DOM elements.
- Don’t perform complicated functions, use Plug-In instead.
Please refer to this page for all the content.
*This post is locked for comments