- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-26-2022 02:08 AM
Hello Community,
I'm stuck on one request catalog item/form in ServiceNow.
The short story is, when for example employee from other country opens this specific form, most of the variables are in employees local language but there is one variable which stays in English.
This is output right now, when user with in his local language opens catalog item, but instead of this English text it should say: "Dokk (Laost otsas)"
I would like to achieve this by using scripts but since I'm quite new with scripting and service now, I cannot come up with solution how to get what I want. Bellow you can see current script, I added this part:
var language = gs.getUserID().preferred_laguage;
But now cannot think of solution how to use it
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
//setLabel = uz out of stock
var country = g_form.getValue('sel_country');
var language = gs.getUserID().preferred_laguage;
if (country == 'EE') {
g_form.setLabelOf('chk_docking', 'Docking station (Out of stock)');
g_form.setReadOnly('chk_docking', 'true');
} else {
g_form.setLabelOf('chk_docking', 'Docking station (for laptop)');
g_form.setReadOnly('chk_docking', 'false');
}
}
Hope You understand my question and what I want to create.
Kind regards,
Jūlijs
Solved! Go to Solution.
- Labels:
-
Service Catalog

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-26-2022 05:50 AM
Hello,
This can be accomplished without script if you switch to the other language (not English) and then create the translated variable with the appropriate name as you'd like.
See this thread for more guidance: https://community.servicenow.com/community?id=community_question&sys_id=bffecba1dbdcdbc01dcaf3231f96...
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-26-2022 05:49 AM
Hello,
You have to add entry in Translated tables, If you have added but still not working then check for existing entry and make changes accordingly. Lastly you can read below article to understand how you can translate easily with debugger
https://community.servicenow.com/community?id=community_blog&sys_id=b7aa7844db94b4144819fb24399619fb
Please hit like and mark my response as correct if that helps
Regards
Regards,
Musab

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-26-2022 05:50 AM
Hello,
This can be accomplished without script if you switch to the other language (not English) and then create the translated variable with the appropriate name as you'd like.
See this thread for more guidance: https://community.servicenow.com/community?id=community_question&sys_id=bffecba1dbdcdbc01dcaf3231f96...
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-26-2022 06:31 AM
Well, unfortunately in my case it's not an option and it's not working like that.
Any ideas, how to fix that with script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-26-2022 07:25 AM
Could you clarify why it's not working as expected? It's not good practice (aka it is bad practice) to do this by script as it introduces technical debt,
I can't quite tell in your screenshot if it's taken via a "form" and you're looking at the Variable formatter, or if you are looking at a Catalog Item / Record Producer in a portal (I'm leaning towards the latter),
In which case, the method highlighted in
* UI translations are essentially just data in five specific tables - if you want to learn more about them, check out my blog post here,
If you still can't get it to work, please send me an email and we can organise a call and my team can have a look into the issue,
Many thanks,
Kind regards
Director of Globalization Deployment, Internationalization