how to use gs.getMessage() in scope?

Meloper
Kilo Sage

how to use gs.getMessage() in scope?
Do we have an alternative?

3 REPLIES 3

Community Alums
Not applicable

Hi @Meloper ,

Recommended way to use getMessage() is 

var message = gs.getMessage("This is the message with params {0}", param);
gs.addInfoMessage(message);

Alternately, it can also be written as 

var message = "This is the message with params {0}";
gs.addInfoMessage(gs.getMessage(message,param));

and it works. 

 

Basheer
Mega Sage

Hi @Meloper 

Go through this link for more information on getMessage

https://www.servicenow.com/community/in-other-news/gs-getmessage-the-second-parameter/ba-p/2279603

 

Please hit like button if my suggestion has helped you in any way.
Please mark correct if my response has solved your query.

Cheers,
Mohammed Basheer Ahmed.

OlaN
Giga Sage
Giga Sage

Hi,

The method gs.getMessage() works in both Global scope, and in Scoped Apps.

You can read more on the Developer site.

 

Do note that you will need to execute the operation once in order to set up the cross scope privileges needed.

 

What issue are you facing?