Translation – Messages (2024)

If your system is going to be used in multiple languages you might need to think twice before you hard code any message for your backend users or Service portal users.Hard coded messages don’t get translated automatically when a user changes languages, in this case what you need to do is to add the message that you want to display on sys_ui_message table which contains your original message as well as the translations for informational messages, confirmation messages, error messages, and other types of system messages.

ServiceNow checks this table for translation when a client script contains a getMessage or a server script contains gs.getMessage call.

The main fields for this table are:
Application: name of the application this message appears in.
Key: internal unique identifier of this message.
Language: language the message is translated into.
Message: translated text that users see.

Here is example:


// Hard coded message
gs.addInfoMessage('Please select the right service for this case');
//gs.getMessage() is going to call value for escalation_msg key, the value displays depend on user's language
gs.addInfoMessage(gs.getMessage('escalation_msg'));

Navigate to System Localization > Messages and then create message for escalation_msg key in both English and French

When the code above triggers, it prints 2 messages in English

Translation – Messages (1)

When user changes language to French

Translation – Messages (2)

Hard coded message displays in English while the other one displays in French

Translation – Messages (2024)

References

Top Articles
Latest Posts
Article information

Author: The Hon. Margery Christiansen

Last Updated:

Views: 5918

Rating: 5 / 5 (50 voted)

Reviews: 81% of readers found this page helpful

Author information

Name: The Hon. Margery Christiansen

Birthday: 2000-07-07

Address: 5050 Breitenberg Knoll, New Robert, MI 45409

Phone: +2556892639372

Job: Investor Mining Engineer

Hobby: Sketching, Cosplaying, Glassblowing, Genealogy, Crocheting, Archery, Skateboarding

Introduction: My name is The Hon. Margery Christiansen, I am a bright, adorable, precious, inexpensive, gorgeous, comfortable, happy person who loves writing and wants to share my knowledge and understanding with you.