Error Message coming twice in workspace view
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Hi Community,
I am trying to add an error message on workspace to show up under certain conditions, when the conditions are met, the message shows up. When we change the tab in the workspace, on some specific tabs, the same message pops up again. How to deal with this, as per my findings it is happening because the main workspace page and the other tab are loading the same table form view?
I want the message to be only visible on one instance, on the main workspace view, not under any tabs.
Thanks,
AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Hey @ar-mi
when you switch tabs, the record form component reloads. If the error message is added through an onLoad client script or similar client logic, the script executes again when the form is re-rendered, which causes the message to appear repeatedly.
Since the same table and form view are used in the main workspace tab and the other tabs, the script does not automatically distinguish between them.
One practical approach is to ensure the message is displayed only once during the workspace session. This can be handled by storing a flag in the browser session and checking it before adding the message.
client script
function onLoad() {
if (!sessionStorage.getItem('errorMsgShown')) {
if (/* your condition */) {
g_form.addErrorMessage('Your error message here');
sessionStorage.setItem('errorMsgShown', 'true');
}
}
}
*************************************************************************************************************************************
If this response helps, please mark it as Accept as Solution and Helpful.
Doing so helps others in the community and encourages me to keep contributing.
Regards
Vaishali Singh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
34m ago
Hi, I have tried this method but the problem I'm facing in this is that once we switch to another record, none of the messages are coming up as I think its taking it as the same session.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
27 seconds ago
hey @ar-mi
To handle this properly, the flag should be record-specific. You can do this by including the record sys_id in the storage key. This way the message appears once per record but will not repeat when switching workspace tabs.
client script:
function onLoad() {
var recordKey = 'errorMsgShown_' + g_form.getUniqueValue();
if (!sessionStorage.getItem(recordKey)) {
if (/* your condition */) {
g_form.addErrorMessage('Your error message here');
sessionStorage.setItem(recordKey, 'true');
}
}
}*************************************************************************************************************************************
If this response helps, please mark it as Accept as Solution and Helpful.
Doing so helps others in the community and encourages me to keep contributing.
Regards
Vaishali Singh

