How to display an Info message in ServiceNow Portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-01-2021 07:08 AM
Hi,
How to display an info message for the service Now Portal when the incident form resolved state changes to the closed state.
Regards,
Priya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-02-2021 03:53 AM
Hi,
Can you share your service portal form?
Also, put an alert message to check whether the script is running or not.
function onLoad() {
//Type appropriate comment here, and begin script below
alert('script is running: '+g_form.getValue('state'));
if (g_form.getValue('state') == 7) { // set the correct closed state value
alert('going inside te loop');
g_form.addInfoMessage('The incident state is already closed');
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-02-2021 04:16 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-02-2021 04:23 AM
Hi,
Can you confirm about the alert messages what it has returned?
Please use the below script,
function onLoad() {
//Type appropriate comment here, and begin script below
alert('table: ' + g_form.getTableName());
alert('state: ' + g_form.getValue('state'));
if (g_form.getValue('state') == 7) { // set the correct closed state value
alert('going inside');
g_form.addInfoMessage('The incident state is already closed');
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-02-2021 04:29 AM
Hi,
No alert messages were displaying in the ServiceNow portal.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-02-2021 04:40 AM
Hi,
You are executing the script on the ticket widget and unfortunately, client script or UI policies will not work.