getResourceString (Client API reference)

Applies to Dynamics 365 for Customer Engagement apps version 9.x

Returns the localized string for a given key associated with the specified web resource.




Name Type Required Description
webResourceName String Yes The name of the web resource.
key String Yes The key for the localized string.

Return value

A localized string.


When you create RESX web resources you must explicitly set the language value and include the locale identifier (LCID) for the appropriate language in the name of the web resource. For example, new_/strings/MyAppResources.1033.resx would contain resources for English language. See Microsoft Locale ID Values for a list of LCID values.

For example Xrm.Utility.getResourceString("new_/strings/MyAppResources","hello") will return the localized string value for the resource key hello within the new_/strings/MyAppResources.1033.resx web resource if the user’s preferred language is English. Notice that the function doesn’t refer to any specific language or full name of any RESX web resource. This functionality depends on the RESX web resource being associated to the calling JavaScript web resource as a dependency. More information: Web resource dependencies.

The appropriate string value will be determined by the individual user’s language preference and the languages available in the organization. If a localized string is not found that matches the user’s language preference, the localized string will automatically fallback to the base language for the organization. If no matching localized string is found for the organizations base language, a null value will be returned.

String (RESX) web resources
Web resource dependencies