Hello CRM colleagues,
I've never worked with JS in CRM before. I'd like to display a text in a form using an HTML field that would show a text according to the users local CRM language. The test code below works just fine, but once I replace var userLcid = 1033; with var userLcid = context.getUserLcid();, the code does not work anymore, no text is displayed. What have I done wrong? What would you do to make it work?
I tried :
- context.getUserLcid()
- getUserLcid()
- window.Xrm.Page.context.getUserLcid()
- Xrm.Page.context.getUserLcid()
- Convert.ToInt32(window.Xrm.Page.context.getUserLcid())
<html><head><meta charset="utf-8"></head>
<body>
<local id="Hinweis"></local>
<script>
var userLcid = 1033; //context.getUserLcid();
var localizedStrings = {
Hinweis: {
_1033: "English text",
_1031: "Deutscher Text"
} };
var LocalizedHinweis = localizedStrings.Hinweis["_" + userLcid];
document.getElementById("Hinweis").innerHTML = LocalizedHinweis ;
</script>
<br>
</body></html>
*This post is locked for comments
I have the same question (0)