- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2023 04:52 AM - edited 03-16-2023 04:53 AM
Hi,
There is a field validation and it will show error message ,if not validated properly.
Now the error message should be shown in different languages based on user's language
How to achieve this?
Thanks in advance!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2023 06:56 AM
do this and it will work based on user's language
getMessage("YOUR_MESSAGE_KEY", function(msgString) {
g_form.showFieldMsg('field_name', msgString, 'error');
});
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2023 05:25 AM
Hi @Buddy 1 ,
to solve this Problem, you need to do the following:
- Create the message translation in the sys_ui_message table
- Create Records with languages you need
- Add the following code in your script to get the translated error according to the user language: gs.getMessage('your error message')
If my answer solved your issue, please mark my answer as Correct & Helpful 😉
Best Regards
Maha
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2023 06:38 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2023 06:42 AM
Hi @Buddy 1,
you have two options:
- you can either create display BR and put the error message in the g_Scratchpad
- you can use GlideAjax and return as a response the translation
In both of them, you will use: gs.getMessage() to get the translated text
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2023 06:56 AM
do this and it will work based on user's language
getMessage("YOUR_MESSAGE_KEY", function(msgString) {
g_form.showFieldMsg('field_name', msgString, 'error');
});
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader