Translate Location Germany Value which is displayed on user profile in service portal

sravya vemula
Tera Contributor

Hi Everyone,

 

I have a requirement where I should translate the word Germany which is shown for users with Germany as Location in User Profile on Service Portal. But Servicenow did not provide translations for cmn_location table. So how can we write a script on user table such that this can work for only Germany Word ? The translation for only Germany should be done and not touching other values in the table.

9 REPLIES 9

sravya vemula
Tera Contributor

This is not allowed in our project. I tried to do widget scripting. This is also not working. Please find below script.

if($scope.data.sysUserModel && $scope.data.sysUserModel.location){
var locationmap = {
'Germany' : 'Deutschland'
};
if(locationmap[$scope.data.sysUserModel.location]){
$scope.data.sysUserModel.location = locationmap[$scope.data.sysUserModel.location];
}
}

@sravya vemula 

did you try to create record into this table "sys_translated_text" for your language?

 

AnkurBawiskar_0-1742282107340.png

 

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

Yes. I tried this. It is nor working

@sravya vemula 

Easiest way is to change the field type from String to Translated Text and system will do the work for you

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

@sravya vemula 

create a message in Messages table

AnkurBawiskar_0-1742287879577.png

 

then add this line in cloned widget to get the translated value

getMessage("Your Message Key here", function(msg){
alert(msg); 
});

If my response helped please mark it correct and close the thread so that it benefits future readers.

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