What is the use of 'message' field in client script??

rm3
Giga Contributor

Hi all, i am new to service now, just wanted to know what is the use of 'message' field in the Client script form. Please clarify this with a simple example if possible...

 

 

1 ACCEPTED SOLUTION

The messages can be anywhere used where messages are applicable. The example is an error message, you could also use this on the info message, alert, etc.. 

You will find the Messages if you navigate to "System UI > Messages".

Below the message from the above example:

find_real_file.png

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark

---

LinkedIn

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

View solution in original post

13 REPLIES 13

Mark Roethof
Tera Patron
Tera Patron

Hi there,

You can use this field for Internationalization or to not hardcode messages within scripting (could be used for English language as well).

Within this field, you would mention the sys_ui_message record (the key). In the Client Script, you could reference that message by using getMessage. Here's an example from on of our instance:

find_real_file.png

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark

---

LinkedIn

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

Hi,

 

This is really helpful. Thanks for that. But if I wanted to display the message under my field from the system UI messages what should I do? Please help...

You can use g_form.showFieldMsg('Field name', message);

 

Hi Mark.  I'm a little confused.  I like the idea of maintaining the message from the Messages field, however, in your example, when you call "getMessage('...')" it appears your entering the message text in the code anyway.  Also, the field name, "Messages" (plural) implies there could be more then one.  Is it possible to add more than one message to the Messages field and refer to the specific message you want to use in the code?