Ultimate Collection - { fslSocial & faisalmb.com } Ultimate Collection - { fslSocial & faisalmb.com }   
Social   |   Site   |   Posts (353)   |   Tags Xplorer   |   Feed Subscribe Free! Aha! you surfing post CRM - Globalization / Loc...    Partner Site - Real Home Contact Search   

Fri

21

Aug

2009

Fri-21-08-2009
   

CRM - Globalization / Localization in Custom Web Application



If you required to set localization / culture in your custom web application that is running in IFRAME section of your CRM Application, according to User preferred language selected by user in Language option, go with the following

 Override the InitializeCulture() method in your custom web application as


        protected override void InitializeCulture()
        {
                base.InitializeCulture();

                WhoAmIRequest whoAmIRequest = new WhoAmIRequest();
                WhoAmIResponse whoAmIResponse = (WhoAmIResponse)crmService.Execute(whoAmIRequest);

                // Get the usersettings entity
                RetrieveUserSettingsSystemUserRequest reqUserSettings = new RetrieveUserSettingsSystemUserRequest();
                reqUserSettings.EntityId = whoAmIResponse.UserId;
                ColumnSet columns = new ColumnSet();
                columns.Attributes = new String[] { "uilanguageid" };
                reqUserSettings.ColumnSet = columns;
                reqUserSettings.ReturnDynamicEntities = true;
                CrmNumberProperty langProp = null;
                int langCode = 0;
                try
                {
                    //Get current logged in user setting
                    RetrieveUserSettingsSystemUserResponse resUserSttings = (RetrieveUserSettingsSystemUserResponse)crmService.Execute(reqUserSettings);
                    DynamicEntity objUserSettings = (DynamicEntity)resUserSttings.BusinessEntity;
                    foreach (Property prop in objUserSettings.Properties)
                    {
                        langProp = (CrmNumberProperty)prop;
                        if (langProp.Name.Equals("uilanguageid"))
                        {
                            //langCode = (CrmNumberProperty)objUserSettings.Properties["uilanguageid"];
                            langCode = langProp.Value.Value;
                            break;
                        }
                    }

                    //Set culture
                    Thread.CurrentThread.CurrentCulture = new CultureInfo(langCode);
                    Thread.CurrentThread.CurrentUICulture = new CultureInfo(langCode);

               }

                catch (System.Web.Services.Protocols.SoapException se)
                {
                    // Log it
                }
        }

If you are looking for Retrieve Cultures information from CRM into your Custom Web Application, have a look at

http://faisalmb.com/blog/post/2009/08/21/CRM-Retrieve-Cultures-information-from-CRM-into-your-Custom-Web-Application.aspx

 


Add Comment Add comment

 
 
 
   Country flag

Click to change image  --> 

biuquote
  • Comment
  • Preview
Loading





Intro

Faisal Bashir
Consultant / Software Architect
KalSoft Limited Dubai
Microsoft Certified Technology Specialist.
[more]

Right Now

How could u reach the pearl by only looking at the sea? if u seek the pearl, be a diver: the diver needs several qualities, he must trust his rope and his life to the Friend's hand, he must stop breating and he must jump - Jalaluddin Rumi.

Random Visuals

facebook privacy application setting 3
facebook privacy application setting 3

Show Next Visual

Recent Comments

Calendar

<<  May 2012  >>
MoTuWeThFrSaSu
30123456
78910111213
14151617181920
21222324252627
28293031123
45678910

View posts in large calendar

The acquisition of knowledge is obligation on every Muslim, male and female. (Muhammad - sallallaho alaihi wassallam - peace be upon him)
723857 hits. (Best viewed @ 1024x768 resolution min.) Comments here...
© 2001-2012 Muhammad Faisal | Disclaimer | Contact | Partner Site