Some important things to note at this time:
Your file must include a function that will be available in the global context.
If you are minifying a large application, you will need to know the name of the function to execute.
Dynamics will handle the import of this single script and will control when the method is executed.
Loading Web Resources into Dynamics
To load web resources into CRM, visit the Settings > Customizations page and click “Customize the System”.
Once that page loads click on “Web Resources” from the left column and then click “New” to add a new web resource.
Note the web resource will automatically be prefixed with new_ so when you are searching for it later, you’ll have to look for the filename you uploaded starting with that string.
Once you have named your file, select it from your file system and click “Save”.
You don’t need to publish new uploads but you will need to click publish when you change an existing web resource.
Next we need to load this script into the Lead entity.
Attaching your Web Resource to Form Events
Now we will be modifying the form to add the new web resource to it. The first step is to open the form editor from the dropdown menu in the ribbon.
The form editor will open a new window and from there you’ll click on “Form Properties”.
Why do I use Form Properties instead of inserting a Web Resource?
Even though you upload your script as a web resource, we must use Microsoft’s Form Properties to insert the script and set it up for execution during the OnLoad event of the form. If you attempt to insert it as a web resource you won’t have the ability to connect it to the form events.
Next, you will click on “Add” to bring your Web Resource into the Form Properties. You’ll need to first add the web resource and then assign the resource to an Event Handler.
Below, you can see an animated example of how you can find your web resource (Remember, it was uploaded with a filename starting with new_) and attach it to the form event.
In this final steps shown above you pull together the file you’ve uploaded with the form and assign it to the Event Handler. Once completed, press “OK” and then Save followed by Publish on the Form Editor window.