Nilesh Pol
Kilo Sage


In ServiceNow Portal (Service Portal / Employee Center), if you want to show language-based error messages without much custom development and as close as possible to OOTB (Out of the Box), use Message Translation and gs.getMessage().

 

Use System Localization Messages (Recommended):

Navigate to:
System Localization → Messages


Create a message:

Key: invalid_user_error
Message (English): Invalid user selected.

 

Create translations for the same key:

Language: French → Utilisateur non valide sélectionné.
Language: German → Ungültiger Benutzer ausgewählt.
Language: Japanese → corresponding translation

 

than In Portal Widget or Server Script:

gs.addErrorMessage(gs.getMessage('invalid_user_error'));

 

NileshPol_0-1783664886862.png

 

This process in ServiceNow automatically displays the message based on the logged-in user's language preference.