How to pre-set Language in servicenow?

Buddy 1
Tera Contributor

How to pre-set language to local language?

For example:

User country is Spain, then the language pre-set needs to be done as spanish.

 

How to achieve this ?

 

Thanks in advance!

5 REPLIES 5

Sonali Nimbalk1
Giga Guru

You can set the default language for an instance.

Do this after activating the plugin for the desired language.

Before selecting a new default language, activate the plugin for the desired language in System Definition > Plugins.

The default global language for the system is set in System Properties > System Localization.
This property defines the language that users with a role see if a language is not specified in their user record.
Users without a role see the default guest language, as described in User-specific language.

 

SonaliNimbalk1_0-1670240616470.png

Please hit like and mark my response as correct if that helps
Regards,
Sonali

Hi @Sonali Nimbalk1 ,

We already have some user records which we needs to change manually . If user has Austria country then by pre-set language he should see German language ,How to achieve this with script? as they are many user records.

Alex Coope - SN
ServiceNow Employee
ServiceNow Employee

@Buddy 1,

The most common way is to do this as part of the transform script or import logic as users populate the [sys_user] table (e.g from AD / LDAP etc). So in your example you could have a loop that checks for the Country and then set the "preferred_language" field on the user record (providing the language has been installed and set-up), then it will set the preference for the user accordingly,

Many thanks,
kind regards

--------------------------------------------------------------------
Director of Globalization Deployment, Internationalization

Sonali Nimbalk1
Giga Guru

@Buddy 1 

 

var user = new GlideRecord('sys_user');
user,addQuery("country", "!=", " ");
user.query();
while(user.next())
{
var user_pre = new GlideRecord('sys_user_preference');
user_pre.initialize();
user_pre.name="user.language";
user_pre.user = user.sys_id;
if(user.country=="Austria")
{
user_pre.value = "at";
}
else if(user.country=="France") // add another country
{
user_pre.value = "fr";  // add another country code
}
user_pre.insert();
}

Please hit like and mark my response as correct if that helps.

 


Regards,
Sonali