locked
How to debug Javascript (Custom) in CRM 2015 using Browser RRS feed

  • Question

  • Hi there,

    I have tried Debugging using IE 11 Developer Tools as well as Chrome. I can see my Javascript Code only under Dynamic Scripts and when I open it and add a breakpoint it is never reached. I have googled a lot but only find Infos related to CRM 2011 which is not working with CRM 2015 and new browser versions. could anybody please tell me how to debug Javascript custom  in CRM 2015 using Browser? Thanks in advance!

    Tuesday, February 21, 2017 6:21 PM

Answers

  • Have you tried including a "debugger;" statement in your code?

    If the code is published and you have the browser dev tools open, it should break at that point if the code it hit. 


    Jason Lattimer
    My Blog -  Follow me on Twitter -  LinkedIn

    Tuesday, February 21, 2017 9:36 PM
    Moderator

All replies

  • Have you tried including a "debugger;" statement in your code?

    If the code is published and you have the browser dev tools open, it should break at that point if the code it hit. 


    Jason Lattimer
    My Blog -  Follow me on Twitter -  LinkedIn

    Tuesday, February 21, 2017 9:36 PM
    Moderator
  • I have tried adding following statment in the initialize code: Xrm.Utility.alertDialog("Inside alert statement"); 

    it just Displays message box but donot break at that Point.

    Any other ideas? :-) Thanks!

    Wednesday, February 22, 2017 12:32 PM
  • My experience is if the JavaScript library is invoked from any of Ribbon controls then such JS library is rendered as Dynamic Script. For Form level JS, you should able to see it under Main.aspx in IE Debugger.

    For Dynamics script, I generally search the JS method name in IE Debugger and it takes me to the script in which it finds matching string, then you can put the breakpoint it that script block.

    Its little difficult to use Chrome debugger, so I usually use only IE for any JS debugging.


    MaKeer

    Monday, February 27, 2017 4:27 AM
  • I think you are doing right...In chrome you can simply press F12 and then go to 'Source'. Search for the JavaScript file and then add a debugger at line number.

    Also as suggested - you can add 'debugger' in JavaScript and publish - this will also enable debugging. But if you cannot publish anything then option 1 will be suggested approach.

    Also, did you tried debugging in any other browser.

    The issue might also be that javascript itself is having some error which is causing it not to be run.

    Monday, February 27, 2017 8:07 AM