Thursday, August 21, 2008

Retrieving User Language Settings via Jscript in Dynamics CRM.

I had a client need to run some code based on what language the user interface was in. In this particular client's setup, there are users that use both French and English user interfaces. The import/export labels tool works well but there were some cases where we needed to show different data on a CRM form based the language.

Good news is that this is a super easy jscript call, you just need to look at the system variables listed below:

//determine language
alert(USER_LANGUAGE_CODE);
alert(ORG_LANGUAGE_CODE);

The code will tell you what language code the user is using, so for english it is 1033, and for french it is 1036. You will need at least one other language pack installed for this to make any sense. So using these values in a "if" statement will allow you to do what you need to do for that particular user's language.

No comments: