How to display message on form?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2018 07:24 AM
Hello Team
I would like to show message on top of the form, before submitting.
My form is like this.
I am new to ServiceNow please help me in this requirement.
- Labels:
-
Team Development

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2018 07:31 AM
You will want to use an onSubmit Catalog Client Script:
Catalog client script creation
Within this, catalog client script, you will use the g_form.addInfoMessage() method:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2018 07:38 AM
Are you trying to show some validation messages ? if so you can use before insert business rules and add message and abort the action.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2018 07:55 AM
On load client script
function onLoad() {
//Type appropriate comment here, and begin script below
g_form.addInfoMessage("your message");
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2018 11:33 AM
Hi KasiRao,
You may use OnDisplay Business Rule and display the message you wanted.
Firstly, you may need to choose Conditions for the Business to Run,
Secondly, Check the Advanced (to True) which will open up the Advanced Tab on the Business Rule form,
Here you may use the below snippnet
(function executeRule(current, previous /*null when async*/) {
// Add your code here
gs.addInfoMessage("Message which I wanted to appear on the form");
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2020 11:47 PM
Hi,
You can use addInfoMessage() method of g_form API.
addInfoMessage(String message)
Parameters:
Name | Type | Description |
---|---|---|
message | String | The message to display. |
If my answer helped you in any way, mark answer as helpful and correct.
Thanks and regards,
Megha.