- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-29-2015 02:58 PM
I was recently inspired by Chuck Tomasi's post on gs.getMessage() - The Second Parameter, but when I tried to add a second parameter to the client-side getMessage() function, it didn't seem to work.
Does anyone know if the client-side getMessage() function does not accept a second parameter like the server-side gs.getMessage() does?
(If it matters, we're currently on Eureka Patch 7.)
Solved! Go to Solution.
- 26,613 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-30-2015 02:50 AM
Hello Michael,
getMessage(String) on client side uses only one parameter vs gs.getMessage(String, Object) that can use a second parameter.
Regards,
Sergiu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-09-2020 06:33 AM
Ooh, interesting! I'll have to try this out (and swap it in for "Correct Answer" if it works).
Out of curiosity, were you referencing any available documentation to discover this, or did you have to do your own sleuthing/trial-and-error?
- The updated server-side documentation is here: legacy GlideSystem on Paris
- I believe this is the [official] updated client-side documentation: i18NV3 on Paris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-09-2020 07:42 AM
Got this from servicenow internal team. I don't know why service now don't update the documentation.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-08-2021 05:06 AM
Hi, I have encountered a problem using the withValues function, I get the following error: "getMessage(...).withValues is not a function".
Do you know what can be the reason for this error?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-14-2025 02:35 AM
getMessage(string) has only one parameter. But there is a way to pass parameters to the string.
For example:
getMessage("Creating new version number {0} and updating in {1}").withValues([variable1, variable2]);
withValues function can be called on getMessage to pass the parameters.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-15-2025 05:21 AM
What is this "withValues" method? It's not a base JavaScript method (that I've found) and does not seem to be documented anywhere by ServiceNow, which brings up the idea of how safe is it to use?
It is a nice way to do the string replacements, but we could just use the "replaceAll" method and feel safe about it. Like:
var message = getMessage("Creating new version number {0} and updating in {1}");
message = message.replaceAll("{0}", variable1);
message = message.replaceAll("{1}", variable2);
Not as pretty, but safer?