Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to Change the system language on the basis of user's preferred communication language?

vishal jaiswal
Tera Contributor

Scenario: There is a field "" in sys_user table and one field "Language" in system setting.

Expected solution: Need to change the system language on the basis of user's preferred communication language.

Example: If user's preferred communication language is FI then system language should automatically change to FI.

Please refer the attached pic.

 

15 REPLIES 15

Ankur Bawiskar
Tera Patron
Tera Patron

@vishal jaiswal 

you can use after update BR on sys_user table

Condition: Language Changes

Script: please refer below link

How to change system language in script

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

BR Script as per the link mentioned

I assume the preferred language has values such as

ES -> Spanish,

FR -> French and so on

(function executeRule(current, previous /*null when async*/) {

    // Add your code here

var util = new I18nUtils();

util.setLanguage(current.preferred_language);

})(current, previous);

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hi Ankur,

I tried this way but it's not changing system language.

Hi,

when I tried this script in background script it worked fine

var util = new I18nUtils();

util.setLanguage('es'); // es means spanish

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader