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.

Get logged in user language into script include

Abhijit Das7
Tera Expert

Hi All,

 

I working with script include . I want to get language of the logged in user into script include.

 

I tried this to use in script include but , it is not working :

var language = gs.getUser().getLanguage();

 

please tell me how to get language of the logged in user.

 

Thanks in advance

7 REPLIES 7

Ramkumar Thanga
Mega Sage

Hi Abhijit,

 

Please use the following.

 

gs.getsession().getlanguage()

 

 

Thanks!!

Ramkumar

 

Please mark this as helpful/Correct

Hi @Ramkumar Thanga 

 

I tried your suggestion , still i am not getting user language.

 

Thanks

Karan Chhabra6
Mega Sage

Hi @Abhijit Das7 ,

 

Please refer to the getLanguage() method:

KaranChhabra6_0-1687521782035.png

 

If my answer has helped with your question, please mark it as correct and helpful

 

Thanks!

 

Hi @Karan Chhabra6 

 

My requirement is to get preferred language of logged in user not session language. In user table there is field called language(preferred_language) , I want to get value from this field.

 

Thanks