locked
How to write/debug code outside of CRM RRS feed

  • Question

  • Hi,

    This might be a silly question, but being a "non-prgrammer" (or at least non C##/Jscript programmer) I need some guidance.

    I basically just want to know if there is a way to write and debug OnLoad/OnSave code outside of CRM? The coding I have done for this so far, I have just written directly on the form in CRM and then just tested if it worked. It's just not that practical so is there a way to do it in e.g. Visual Studio and then be able to test it from there against the CRM environment?

    What do others do?

     


    Steen Schlüter Persson (DK)
    Tuesday, April 6, 2010 11:44 PM

Answers

All replies

  • If you add the keyword debugger; to your code then you can choose your debugging application when it hits this breakpoint. Also you can use the IE Developer Tools.
    MSCRM Bing'd - http://bingsoft.wordpress.com
    Wednesday, April 7, 2010 7:34 AM
    Moderator
  • Hi Steen,

    you can try the JavaScript Factory of stunnware http://stunnware.com/default.aspx?area=products&group=jsf4&subarea=jsf4-overview
    It gives you at least Intellisense support and the possibility to manage the Scripts from Visual Studio. Debuggin outside of CRM is IMHO not possible, because you have to mock the context.

    Wednesday, April 7, 2010 8:12 AM
  • Hi Steen,

    To write a Javascript Intellisense mode can help you (you can use this link http://crm.vdsnickt.eu/ms-crm-javascript-intellisense-generator/ ) .

    To debug your Javascript you can add the command debugger on your code then enable debugging Javascript on your browser finally when it hits this breakpoint you have to choose your program for debugging.

    Otherwise,the new IE developper Tollbar allow you to dubug your script.


    Best Regards, Lassaad
    • Proposed as answer by Lassaad.Cabani Wednesday, April 7, 2010 5:01 PM
    Wednesday, April 7, 2010 8:32 AM
  • Hello Steen,

    To contribute to the previous responses, here is another excellent blog post by Daniel Cai that discussses two different approaches  for referencing external JS scripts from CRM Forms:

    http://danielcai.blogspot.com/2010/02/another-talk-about-referencing-external.html

    Good Luck,

    Ivan Kurtev

    Wednesday, April 7, 2010 3:06 PM
  • If I understand you correctly, your question is not much about javascript, but catching events such as onsave, onpresave, ondelete, etc. This can be done by writing a plugin in C# or VB in Visual Studio. The SDK of CRM 4.0 will give you a start with this: http://www.microsoft.com/downloads/details.aspx?FamilyID=82E632A7-FAF9-41E0-8EC1-A2662AAE9DFB&displaylang=en

     

    • Marked as answer by Jim Glass Jr Monday, April 12, 2010 3:08 PM
    Wednesday, April 7, 2010 3:10 PM
  • Hi,

     

    Thanks for all your suggestions. I'll look into them and see what I can get out of it.


    Steen Schlüter Persson (DK)
    Monday, April 12, 2010 6:27 AM
  • Hi,

    This might be a silly question, but being a "non-prgrammer" (or at least non C##/Jscript programmer) I need some guidance.

    I basically just want to know if there is a way to write and debug OnLoad/OnSave code outside of CRM? The coding I have done for this so far, I have just written directly on the form in CRM and then just tested if it worked. It's just not that practical so is there a way to do it in e.g. Visual Studio and then be able to test it from there against the CRM environment?

    What do others do?

     


    Steen Schlüter Persson (DK)

    Hi Steen,

    brilliant!! thanks for asking this quesstion, as I was also about to ask sometjing similar but was unsure how I should word it, as I too am a non programmer (but think I will be becoming one ;-))......the response you have got from this is brilliant and has given me loads to try as well...:-)

     


    Cheers and regards Rossco
    Monday, April 12, 2010 7:23 AM