Knowledge found and lost while working with Microsoft Dynamics CRM
RSS icon Home icon
  • Dynamics CRM 3.0 Client-side Programming: Commenting Your Code

    Posted on March 3rd, 2006 Mitch Milam Print Print No comments

    I was browsing the CRM 3.0 SDK the other day and ran across the following little tidbit:

    Another improvement in scripting is that when you edit scripts, all formatting is retained to improve readability and maintainability.

    Note   Use of /* … */ style comments is preferred in scripts.

    If you didn't know, JavaScript supports two kinds of comments:

    • Block: /* */
    • Single Line: //

    The above note caught my attention because I had just ran into an issue regarding the single line comments. I was using it to comment out the last line of an Event and I was getting JavaScript runtime errors. Removing the code that was commented-out stopped the errors.

    That's when I realized that CRM 3.0 was removing trailing line breaks from the Event code and turning my Single-line Comment into a showstopper by including the trailing } in the comment and rendering the code "incomplete."

    Consistent use of block comments will prevent code issues like this all together and I've had zero issues since I switched.

     

    Customization, Dynamics CRM
    1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
    Loading ... Loading ...
    1,561 views

    Leave a reply