I saw several threads on community forums that state “Xrm.Utility.getResourceString” functionality doesn’t work in Html webresources. I decided to spend some time digging to find out why it doesn’t work and how to make it work.
During investigation I found out that Html window missed several objects that were available on regular entity form. Unfortunately I was not able to find easy way to create those object so I composed solution that composes and initiates all the required objects on the form. Here is what should be done to make “Xrm.Utility.getResourceString” work again:
- download and import to your system following managed solution – https://github.com/a33ik/HtmlLocalization/releases/tag/126.96.36.199
- add a reference to “HtmlLocalization.js” to your Html webresource. Be attentive with relative paths when you reference this file!
<meta charset="utf-8" />
var a = Xrm.Utility.getResourceString("ab_/Messages", "LocalizedMessage");
console.log("Localized Value - " + a);
This is the first release of the product and I haven’t done massive testing so if you found a bug or have suggestions feel free to leave your comment here or open an issue on the GitHub repository.