locked
CRM 4 - question on 'global' functions RRS feed

  • Question

  • Good morning.

    I have a question regarding global JavaScript functions in CRM 4.  I was under the impression that I could create a function, in a form's onLoad event, and I could then reference this function in other events such as fields' onChange and the form's onSave; however, when I try this approach, I generally receive an error message stating that "The value of the property <function name> is null or undefined, not a Function object.  This is telling me that within the specific event, it can't find that function as being defined.  Am I correct?  Can you create global functions on form load?


    Thanks, God bless! Michael C. | Using Win 7, IE9, CRM 4.0 - Rollup 15

    Tuesday, October 30, 2012 2:14 PM

Answers

  • Hello,

    you have to create global function in onload only and it should look like below in onload

    FunctionName=function()  //global function in form onload

    {//rest of the code

    }

    calling of global function in other events

    FunctionName();


    Contact Me
    Follow me on Twitter
    Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question.

    Tuesday, October 30, 2012 2:39 PM
    Moderator