XRM / Dynamics CRM Example Code Repo
- Examples 1. and 2. using Webpack and TypeScript for Form Library development.
- Example 1. Shows how you can combine entity form and ribbon scripts (per entity) into one file (with all dependencies included) by using Webpack as build tool.
- Example 2. Shows how you can combine all entity form scripts into one file and all entity ribbon scripts into one file (with all dependencies included) by using Webpack as build tool.
- more to come ...
- install node with npm included.
- run
npm installfrom the root folder to install all npm dependencies (i.e. Webpack, TypeScript, etc.).
-
Shows how you can combine entity form and ribbon scripts (per entity) into one file (with all dependencies included) by using Webpack as build tool.
-
run
npm run example_1from the root folder to build. The build output can be found in thedist\example_1folder.Example output:
- mdocter.account.js and mdocter.account.js.map (=sourcemap)
- mdocter.contact.js and mdocter.contact.js.map (=sourcemap)
- NB. *.js files are minified with Webpacks Uglify Js plugin.
Usage example on the Account form:
- Add the build output *.js files as JavaScript web resources to some solution;
- Open the Account Main/Primary form in the CRM Form Editor;
- Open the 'Form Properties' by clicking the button in the ribbon;
- Add the
mdocter.account.jsfile as a form library to the form; - In the 'Event Handlers' section, add an
OnLoadevent by clicking the plus-button above the event handlers subgrid; - Select the
mdocter.account.jslibrary and addmdocter.formjs.account.onLoadas Function name.
-
Shows how you can combine all entity form scripts into one file and all entity ribbon scripts into one file (with all dependencies included) by using Webpack as build tool.
-
run
npm run example_2from the root folder to build. The build output can be found in thedist\example_2folder.Example output:
- mdocter.form.js and mdocter.form.js.map (=sourcemap)
- mdocter.ribbon.js and mdocter.ribbon.js.map (=sourcemap)
- NB. *.js files are minified with Webpacks Uglify Js plugin.
Usage example on the Account form:
- Add the build output *.js files as JavaScript web resources to some solution;
- Open the Account Main/Primary form in the CRM Form Editor;
- Open the 'Form Properties' by clicking the button in the ribbon;
- Add the
mdocter.form.jsfile as a form library to the form; - In the 'Event Handlers' section, add an
OnLoadevent by clicking the plus-button above the event handlers subgrid; - Select the
mdocter.form.jslibrary and addmdocter.formjs.account.onLoadas Function name.
Author: Maarten Docter (@mdocter)