web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

How to display error based on CRM user's language option using JavaScript

(0) ShareShare
ReportReport
Posted on by 71

I need to display an error on the CRM form based on the user's language setting. ex: french user - error needs to be displayed in french. How do i get the language(English or French) that the user has set up in the personalization setting in CRM? 

This is where i need to add error message based on the language option

function checkDuplicateTANDForSameOrg (executionContext) {
const formContext = executionContext.getFormContext();

var Entity = "contact";
var Select = "?$select=fullname";
var Filter = "&$filter=contactid eq '3D36A874-49F6-EC11-82E5-002248AE4B85'";

Xrm.WebApi.retrieveMultipleRecords(Entity, Select + Filter).then(
function success(result) {
if (result != null && result.entities.length > 0) {
formContext.ui.clearFormNotification("contactid");
} else{
formContext.ui.setFormNotification("The organization for the selected contact should be same as the organization of the ROD contact.", "ERROR", "contactid");
}

},
function (error) {
console.log(error.message);
}
);

}

I have the same question (0)
  • Verified answer
    Guido Preite Profile Picture
    54,086 Moderator on at

    you can get the user language from the userSettings, this is the docs page

    https://docs.microsoft.com/en-us/power-apps/developer/model-driven-apps/clientapi/reference/xrm-utility/getglobalcontext/usersettings

    you will need to do something like

    let languageId = Xrm.Utility.getGlobalContext().userSettings.languageId;

    and you need to check the languageId returned (LCID)

    this page contains some LCID mapping: https://docs.microsoft.com/en-us/previous-versions/office/sharepoint-csom/jj167546(v=office.15)

  • SivaR Profile Picture
    71 on at

    Thank you, it worked

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
ManoVerse Profile Picture

ManoVerse 193 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 128

#3
CU11031447-0 Profile Picture

CU11031447-0 100

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans