How can I retrieve the language on a specific user in script

demgnekamdem
Tera Contributor

Hi all,

I know that the script gs.getSession().getLanguage() allow to retrieve the current user's language. But I want to retrieve the language of a specific user in script. Example, How can I retrieve the Fred LUDDY 's language in script ?

Thanks in advance,

Carole 

5 REPLIES 5

Aman Kumar S
Kilo Patron

You can use below script:

gs.getUser().getLanguage();

 

Feel free to mark correct, If I answered your query.

Will be helpful for future visitors looking for similar questions šŸ™‚

Best Regards
Aman Kumar

This is for the current user, I want to get the specfic language of another user

You need to glide the user table and get the information.

var lng = new GlideRecord("sys_user");

if(lng.get('sys_id_of_the_user')){

lng.getValue("preferred_language");

}

Best Regards
Aman Kumar

Joseph Gabriel
Tera Contributor

var userId = "some_sys_id";

var languageCode = gs.getUser().getUserByID(userId).getLanguage();