One of the most impressive things about the CRM2011 framework is the amount of customization that can be done right from the GUI of the application. Considering we implemented CRM 4.0 only a couple of months before CRM2011 was initially released I am a bit disapointed at the amount of rework for some small modifications. But making these modifications has submerged me in the customibilty of CRM 2011.
Start with going to Customizations under settings.
Once inside customizations look for Web Resources
Under web resources click the new button. This will pop up a form that will allow you to add your new web resource.
Depending on the type of web resource you may get the text editer. This allows you to write your code directly in GUI or you can upload a code file. This option is going to be available for all of the “code” type web references, but not for images and things that would obviously have to have a physical file associated.
At the top of the form, notice the publish. This just like all other cusotmizations funcitonaltiy with in CRM requires publishing. Once published you can pull this into actions on forms and fields of your entities.
Now lets put it on a form
While in the Customizations screen look for Entities along the left menu.
Drop down the triangle till you have selected the entity you want to add the code file too and go to the Forms.
Inside Form properties is where you add the file you added to the web Resource library to the form
In this case I added a js file called new_IframeEmail.js in the top panel. This will make it avaialable inside the form to be assigned to field actions, tab actions or form actions.
In the bottom panel. You add the event handlers. In this case I want the Iframe to load in the window “onload” of the form. From this screen you could make this code activate on any of the fields in the form from an “onchange” state. There are a number of states depending on the field you are selecting.
From here you can add additional files from the library but instead of having every element avaialble to you for events you will only have the ones relevant to the element you are in the properties for. You can change the order of how the code fires and you can edit it from both of these pages. I do want to warn you again. When you make changes to this file it will make changes to the master file. So every instance of the file will be updated.
To make the changes appear you will need to save the form and then publish the changes, this will publish code changes as well as form changes.
I do also want to warn against over “eventizing” you code. If you have code that seems to end up in an endless loop, look to see if you have it associated with multiple events in your form. This will cause the page to load slowly and can cause over-writing issues.
I will be moving into more advanced customization, but if you are looking to get started and add some simple functionalist to extend the CRM 2011 UI this should point you in the right direction.