CRM JScript Bug
Sure, we all know how to write comments in JavaScr... I mean "JScript" - you just put this before your one-line comment: //. Well, recently, I had a strange problem with some JScript. I knew it was 100% correctly written, but it was throwing errors, saying I was missing an end bracket - }. Weird, I thought, as I closed all my if/else statements and all my functions that I defined, (you know how to do that in CRM, right? crmForm.MyFunctionName = MyFunctionName(){//stuff} and then you can use it throughout the rest of that same form's events - even on field events - by saying crmForm.MyFunctionName().) so I was really in a quandary. I looked at the last line in my event handler, and it was a comment. I.e.
// The previous line did whatever
So, I moved that comment above the aforementioned line, and it worked!
So, what's the bug mentioned in the title? You can't end your JScript event handlers with a comment, even if it's at the end of a line of code. I.e. this is illegal:
alert("Hello, world!");
// Say hello to the world
As is this:
alert("Hello, world!"; // Say hello to the world
Just say this:
// Say hello to the world
alert("Hello, world!");
Pretty lame, I know, but it should save some readers some headaches.