- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-31-2023 01:17 AM
Hi Community!
I have made a br Before - Update to prevent user comments on a closed HR case (active is false)
AbortAction and ErrorMessage are added.
It is working perfectly in the Portal view, because every time we hit the Post button, the form will be also reloaded, and the error message appears.
But in the Native UI view, every time we hit the Post button, comments are not added, but the error message does not appear until we reload the form or go to another place.
So I am finding a solution to have the same behavior as the Portal view to increase the user experience, it means every time we hit the Post button in the Native UI view, the error message appears at the same time, same page.
Thank you!
Fin Nguyen
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-01-2023 02:03 AM
Hi @Fin Nguyen
The most effective strategy would involve establishing an ACL Write to restrict users from updating Closed Cases. I'm just wondering why we permit users to add comments and then attempt to prevent this action afterward.
You can find similar OOTB concept in the Incident table.
After define the ACL, if necessary you can create one more OnLoad Client Script to show the message on the form of Closed Cases.
Cheers,
Tai Vu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-31-2023 01:55 AM
Hi @Fin Nguyen ,
I have faced the same, that's the behavior in native UI!!
Refer to this thread : https://www.servicenow.com/community/developer-articles/how-to-show-warning-messages/ta-p/2330020
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-31-2023 01:59 AM - edited ‎10-31-2023 02:07 AM
Hi @Fin Nguyen
With addition to your Business rule , you can write onChange client script on "Additional comments" field :
Type : onChange
Field : Additional comments
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading) {
g_form.clearMessages();
return;
}
var state1 = g_form.getValue('state'); //you can use your condition fields (like active)
if (state1 == 3) {
g_form.clearMessages();
g_form.addErrorMessage('Case has been closed');
}
}
ServiceNow Developer
I know one thing, and that is that I know nothing.
- Socrates
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-01-2023 02:03 AM
Hi @Fin Nguyen
The most effective strategy would involve establishing an ACL Write to restrict users from updating Closed Cases. I'm just wondering why we permit users to add comments and then attempt to prevent this action afterward.
You can find similar OOTB concept in the Incident table.
After define the ACL, if necessary you can create one more OnLoad Client Script to show the message on the form of Closed Cases.
Cheers,
Tai Vu