locked
CRM 2013 online, function expected or undefined RRS feed

  • Question

  • Hi,

    CRM online is very annoying.  When I create a javascript as simple as it just contains an alert(); statement.  If I attached the function to onchange event of a field, or onload of a form, it either returns 'Function expected' or 'function is undefined' error.  I went back, it is defined, saved and published well.  Is there any trick of defining a javascript function in CRM 2013?

    Tuesday, November 18, 2014 10:50 PM

All replies

  • can you please try to delete the browser cache and see if it helps?.

    regards

    Jithesh

    Wednesday, November 19, 2014 1:35 AM
  • can you post the exact code you wrote?

    My blog: www.crmanswers.net - Rockstar 365 Profile

    Wednesday, November 19, 2014 3:22 AM
  • I did face the same issue and I tried in other machine. It worked well. Try publishing customizations in other machine and then check in your machine.

    Regards,
    Gopinath

    Wednesday, November 19, 2014 4:41 AM
  • Hi, everyone-

    Thank you very much for your responding this thread.  'Function expected' or 'function is undefined' usually mean there is a syntax error in the function you are running or debugging.  Finding a syntax error is pain in the 'XXX' in CRM native text editor.  It is very frustrating and time-consuming.  Sometime, it could be caused by an apostrophe you simply copied from Html page, etc.

    In this case, it is because I did not declare one variable with 'var' before I assign it a value.  It took me a few hours by removing all my code, then add line by line to pin-point where is the problem.  Like to share the experience with anyone who is stuck in a similar frustration.

    Wednesday, November 19, 2014 6:03 PM
  • don't use the CRM native text editor.

    Use Visual Studio (also the express version is sufficient) or another text editor (like notepad++) that highlight the syntax and indicates easily this kind of errors.


    My blog: www.crmanswers.net - Rockstar 365 Profile

    Wednesday, November 19, 2014 6:38 PM