gs.addErrorMessage() is cleared automatically after 2 seconds
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2023 03:40 AM
Hi developer community,
I created a simple business rule which aborts an action if someone tries to change the value in the field "assigned_to" and if there is an open part requirement record at the same time (errors based on states).
The issue is that if I call setAbortAction(true) the gs.addErrrorMesage() shows the error only for 2 seconds.
I tried all orders from these 3 functions but nothing worked. (setAbortAction(true), addErrorMessage(), setRedirectURL())
Does someone have an idea?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2023 03:46 AM
That is the default behaviour of servicenow.
Refer https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0713722 for more details
Please mark the answer correct/helpful accordingly.
Raghav
MVP 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2023 04:12 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2023 04:34 AM
I tend to build it to be more proactive than reaction. Block them before they can do it.
- could block access to the field with ACL and conditions/role
- could use a client script (if it's a form issue) to set the field to read only.
- could use a onChange client script to post the error if basic. or call an ajax to build conditions, if returns true, then use g_form.addInfoMessage.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2023 04:59 AM
check the line setRedirectURL is inorrect syntax,Please find below appropriate syntax:
gs.setRedirect(url);
Please mark as accept solution if it resolves your issue.