Java, javascript, jscript and so forth

When developing software customizations for SharePoint and MS CRM 3, javascript is often used. It can easily be confused with the totaly unrelated language java. Mennotk’s blog has a posting linking to another blog that describes in a bit more detail what javascript, jscript and so forth really is. Being a developer in MS CRM and SharePoint, where this is one of my main tools, I found this quite enlightening and it sheds some light on some question marks I personally had on the subject of javascript and client side scripting.

Please have a look if you are interested: http://blogs.msdn.com/gauravseth/archive/2007/08/15/the-world-of-jscript-javascript-ecmascript.aspx

Gustaf Westerlund
CRM and SharePoint Consultant

Humandata AB
www.humandata.se

Javascript event handling and dynamic lists in SharePoint

As many of you already know and probably have used, it is possible using javascript to create dynamic drop-down-lists. For instance one drop-down list that selects country and another that lets you select a city in that country. Depending on which country you select, you want the options in the city drop-down to change.

This is a quite common task in MS CRM where javascript is a common tool. In SharePoint however, javascript isn’t as common. I am currently working with a colleague of mine, Sebastian Tegel, at a large swedish customer of ours. They had this requirement on some metadata in a SharePoint library so Sebastian and I used the same principles as I usually use in MS CRM to create dynamic drop-down lists in SharePoint. Sebastian has a very nice and instructive posting on his blog on how this is done. Please have a look at it: http://sebastiant.blog.com/2023682/

In the posting before that, he also describes how to create your own custom edit form for a document properties page. This is very useful in these cases, so please have a look at that as well. (http://sebastiant.blog.com//custom+forms/).

Gustaf Westerlund
CRM and SharePoint Consultant

Humandata AB
www.humandata.se

Problems with read-only fields…

When creating javascripts in general and when working with AJAX-based javascripts (javascripts that access server based information) specifically, it is not uncommon to update attributes in CRM-forms. If these attributes are “Disabled” using the form-editor or are disabled using javascript in with the following code:

crmForm.all.xxx_myfield.Disabled = true;

Then any updates to the data of this field, will NOT be saved when the form is saved. There is a way to bypass this and this is to set the attribute to “Read only” instead, with the following javascript code:

crmForm.all.xxx_myfield.readOnly = true;

This will disable any editing of the field by the user, but any data that is modified will still be saved.
I have some other stuff I will share with you soon aswell.

Gustaf Westerlund
CRM and SharePoint Consultant

Humandata AB
www.humandata.se

Use url-parameters in javascripts in CRM

I had a look at Jonas Deibe’s blog today (Jonas is the foremost CRM expert at Microsoft Sweden) and found an interesting tip I thought I’d tell you about.

He explains how to catch a url-parameter in the Javascript code, something I’d find very useful, especially if creating an integration with for instance SharePoint, since I can use this to control what is shown and what is not.

For instance, if you have a sharepoint integration with CRM where there is an IFRAME on the accounts showing the customer site in SharePoint, and the customer site shows the CRM account in an IFRAME also. It might be advisable to not show the IFRAME showing the sharepoint site, if it is shown in Sharepoint (=loop). Then you could use this technique to handle this.

It could also be used for shooting data into a CRM form from some other system. The URL-parameter could then be written to a specific field, it could even be saved and closed using the javascript command for that, in essence creating a very simple integration of data. Not very beautiful but still might be useful, since it is easy to create and very unobstrusive. Might be interesting if a program can’t consume webservices for instance.

There are certainly a million other uses for this, so enjoy!
http://blogs.msdn.com/jonasd/archive/2007/04/16/render-hidden-values-in-tester-mode-by-using-querystring-parameters.aspx

Gustaf Westerlund
CRM and SharePoint Consultant

Humandata AB
www.humandata.se