Wednesday, May 16, 2012

CRM 2011 Javascript old times same struggle with syntax

Oh where did the time go? It is already May and I guess I skipped April this year ;) I am back in the field and actually doing some basic coding not the C# stuff but good old JavaScript.

I did start ages ago and just to add some historic facts a quote:

"...JavaScript was originally developed in Netscape, by Brendan Eich. Battling with Microsoft over the Internet, Netscape considered their client-server solution as a distributed OS, running a portable version of Sun Microsystem's Java... " (source wikipedia)"

Basically you like it or you hate it. In my case I need to do it often too keep track of the DOM and the syntax. In CRM 2011 as you noticed there are some changes made in comparison with CRM 4.0. Nevertheless the basic stuff of hide, show, copy files is nice, but interesting part is calling web services and this could give you some nice functionality. Also the way you can store your coding in CRM is definitely improved.

Example code and yes no guarantees it works :-)

So, basically I was making some ugly script and run of course in bug with getting the value of check box. It works fine when you use radio button or list, but not with the famous box. There was some workaround, but of course we try to use supported coding for a change and lucky I could change the layout of the checkbox and got the script working on a onChange event.

I also tried to add some JSON but I stranded on the CRM 2011 permission got some error stating the protocol was not supported. I got tipped by colleague to use " XrmServiceToolkit" and this would help you to use SOAP and worked like a charm :)

So happy scripting :)

No comments: