MS CRM 2011: My first experience. Adding OnLoad event script.

Today I've started studing functionality of new MS CRM 2011. I want to descover client scripting first and today I've added OnLoad event script. I want to share steps I've made to add script on the form.

1. Locate entity you want to customize. Select Customize tab and then press Customize Entity button. Choose Forms and then double click Main form. Main form designer will be opened:

2. At the home tab locate and press Form Properties button. Properties' form will be opened. Click Add:

3. At the lookup dialog press New:

4. Type name, select Script(JScript) as type and edit JavaScript text to create new script resource. Save and publish your web resource:


5. Create OnLoad even handler. To do that press Add button and set Handler Properties as shown below:


6. Close Properties' form. Save you changes and publish them:

7. That's all:

5 comments

avatar

Hi Marat,

I still cannot seem to get this to get.
I have tried to create my alert in the opportunity entity. I have followed your steps but nothing seems to be going happening (no alert popping up)

Thabiso Motloung

avatar

For me the event is already firing when the form did not finish loading (I try to access the crmUserInfo div in the DOM but it doesn't yet exist?).

avatar

Hi, If I want to display 'Hello World' when user enters into MS CRM 2011 home page.

In that scenario, how can we achieve this.

avatar

Thanks, this example still works in CRM 2015 (but UI has changed quite a bit.)