Thursday, August 26, 2010

Declare Global Access Level functions in MS CRM Form.

Global functions in MS CRM Form.

The way CRM adds the javascript to the page, any function defined in the onload event will only have a local scope and can only be called from within the same onload event. However, if you put the function on the window object, then it should have global scope:window.MyCustomFunction = function() { ... }And then you should be able to call the function from an onchange event.

1. Go to MS CRM -> Customisations -> Customise Entity -> Choose Entity -> Form and View2. Go to OnLoad()3. Put the above fucntion onLoad() // Should be first statment.4. Go to OnSave()5. Call this function, MyCustomFunction();6. When you try to save the entity record this fucntion will get executed.

Followers

Subscribe To - MSCRM-Developer

Disclaimer

These postings are provided "AS IS" with no warranties, and confers no rights. The content of this site are my own personal opinions and do not represent my employer's view in anyway. In addition, my thoughts and opinions often change, and as a weblog is intended to provide a semi-permanent, point in time snapshot, you should not consider out of date posts to reflect my current thoughts and opinions.