- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2024 01:43 AM
Question:
I have been tasked with localizing static error messages in ServiceNow to support multiple languages. Instead of using hardcoded strings for error messages, how to implement a solution to fetch the messages from a language-sensitive resource file.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2024 01:51 AM
Hello @SandeepKSingh
The static error messages should be localized to support multiple languages. Use ServiceNow’s g_i18n.getMessage() method to fetch messages stored in a language-sensitive resource file instead of hardcoded strings.
Example:
gel('error_msg').innerHTML = g_i18n.getMessage("Contract End date should not be empty, Please select a contract's End date.");
To add these messages, navigate to System UI > Messages in ServiceNow, and create entries for each of the required strings (e.g., "Contract start date should not be empty, Please select a contract's start date.").
More Details :- https://docs.servicenow.com/bundle/xanadu-api-reference/page/app-store/dev_portal/API_reference/i18N...
If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!
Thanks and Regards
Ravi Gaurav | ServiceNow MVP 2025,2024 | ServiceNow Practice Lead | Solution Architect
CGI
M.Tech in Data Science & AI
YouTube: https://www.youtube.com/@learnservicenowwithravi
LinkedIn: https://www.linkedin.com/in/ravi-gaurav-a67542aa/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2024 01:51 AM
Hello @SandeepKSingh
The static error messages should be localized to support multiple languages. Use ServiceNow’s g_i18n.getMessage() method to fetch messages stored in a language-sensitive resource file instead of hardcoded strings.
Example:
gel('error_msg').innerHTML = g_i18n.getMessage("Contract End date should not be empty, Please select a contract's End date.");
To add these messages, navigate to System UI > Messages in ServiceNow, and create entries for each of the required strings (e.g., "Contract start date should not be empty, Please select a contract's start date.").
More Details :- https://docs.servicenow.com/bundle/xanadu-api-reference/page/app-store/dev_portal/API_reference/i18N...
If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!
Thanks and Regards
Ravi Gaurav | ServiceNow MVP 2025,2024 | ServiceNow Practice Lead | Solution Architect
CGI
M.Tech in Data Science & AI
YouTube: https://www.youtube.com/@learnservicenowwithravi
LinkedIn: https://www.linkedin.com/in/ravi-gaurav-a67542aa/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2024 02:08 AM
This worked thanks 🙂