message shouldnt come in cab workbench
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago - last edited an hour ago
I wan to restrict message in cab workbench page , however i am not getting message anywhere not in classic UI not in SOW not in cab workbench , however i need message in classic UI and in SOW .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
Hi ServiceNow10sun,
Why your message is not showing anywhere
The issue is in your script:
g_from.addinfomessage("Hi");
Typo:
g_from- Should be →
g_form
Because of this:
- Script is failing silently
- Message is not displayed in Classic UI, SOW, or CAB
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
i have corrected but still its not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
g_form.addInfoMessage()
Works in Classic UI
Not reliable in Workspace (SOW / CAB Workbench)
That’s why you’re not seeing the message.
function onLoad() {
// Skip Workspace (SOW + CAB)
if (typeof NOW !== 'undefined') {
return;
}
var state = g_form.getValue("state");
if (state === "-5" || g_form.isNewRecord()) {
g_form.addInfoMessage("Hi");
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
44m ago - last edited 43m ago
1. Ensure the Client Script has UI Type set to All
Try with this code. If any error is throwing from your current code, please share that.
return;
}
