How to get the Current Organization Settings using JavaScript in Dynamics 365 V9.X?

Below is the New Syntax available to get Current Organization Settings in Dynamics 365 V9.X,

var organizationSettings = Xrm.Utility.getGlobalContext().organizationSettings;

The organizationSettings object provides following propertiSELRES_9e827887-e80e-4701-803c-ed9d51c22944SELRES_cb9358a4-783e-469a-80a0-29a2ac8ee3f7SELRES_b890e71f-c06b-4ce9-a24a-a17bfb5db450SELRES_a4fc1d9c-9f44-47c2-83a9-985e52e8f7a3SELRES_e24bf811-7ea2-4a3b-944f-f6e83797109aSELRES_7c5468be-ec29-4be3-839e-54997f6da776SELRES_17d15528-4b44-4ddb-b280-8a186a56999fSELRES_2528afac-6b72-49d3-836d-6498b40d5dc6SELRES_2528afac-6b72-49d3-836d-6498b40d5dc6SELRES_17d15528-4b44-4ddb-b280-8a186a56999fSELRES_7c5468be-ec29-4be3-839e-54997f6da776SELRES_e24bf811-7ea2-4a3b-944f-f6e83797109aSELRES_a4fc1d9c-9f44-47c2-83a9-985e52e8f7a3SELRES_b890e71f-c06b-4ce9-a24a-a17bfb5db450SELRES_cb9358a4-783e-469a-80a0-29a2ac8ee3f7SELRES_9e827887-e80e-4701-803c-ed9d51c22944es.

Syntax Type Description
organizationSettings.attributes Object An object with attributes and their values.
organizationSettings.baseCurrencyId String ID of the base currency.
organizationSettings.defaultCountryCode String Default country/region code for phone numbers.
organizationSettings.isAutoSaveEnabled Boolean true if enabled; false otherwise.
organizationSettings.languageId Number Preferred Language ID. For example: 1033 for English
organizationSettings.organizationId String Id of the current organization.
organizationSettings.uniqueName String Unique name of the current organization.
organizationSettings.useSkypeProtocol Boolean true if Skype protocol is used; false otherwise.

Example: Below function configured in Account Page Load.

function GetOrganizationDetails() {
 var outputText = "Organization Details\n--------------------------------------------\n";
 var organizationSettings = Xrm.Utility.getGlobalContext().organizationSettings;

outputText += "Unique Name : " + organizationSettings.uniqueName +"\n";
 outputText += "Id : " + organizationSettings.organizationId + "\n";
 outputText += "Language Id : " + organizationSettings.languageId + "\n";
 outputText += "Base Currency Id : " + organizationSettings.baseCurrencyId + "\n";
 outputText += "Default Country Code : " + organizationSettings.defaultCountryCode + "\n";
 outputText += "Is Auto Save Enabled : " + organizationSettings.isAutoSaveEnabled + "\n";
 outputText += "Use Skype Protocol : " + organizationSettings.useSkypeProtocol + "\n";
 outputText += "Attributes : " + organizationSettings.attributes;

Xrm.Utility.alertDialog(outputText, null); 
}

Output:

Organization Details
Current Organization Settings
Organization Details JS Debug
Debug Mode

Hope you learned a new thing today :):):)

 

Advertisements