- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2025 04:09 AM - edited 08-22-2025 04:10 AM
Hi all,
I have a requirement to show a friendly user message, if a user is not permitted to move a problem from state resolved to closed. There is a quality assurance check, so only those with the role "problem_manager" must be able to move from resolved to closed.
On the image below I have added a message in a user friendly language. Is it possible to remove the other two messages, so only mine is shown to the user?
I have tried to add a business rule to run before update with this condition: previous.state == 106 && current.state == 107 && !gs.hasRole('problem_manager') but it doesn't work (nevermind the "technical lead", that's for non-major problems). It still show the OOTB messages.
(function executeRule(current, previous /*null when async*/) {
var user = gs.getUser();
var isProblemManager = user.hasRole('problem_manager');
var isTechLead = ((user.getRecord().getValue('title') || '').toLowerCase() == 'technical lead');
var stateWasResolved = (previous.state == 6); // Resolved
var stateIsClosed = (current.state == 7); // Closed
if (stateWasResolved && stateIsClosed) {
if (current.major_problem == true || current.major_problem == 'true' || current.major_problem == 1) {
if (!isProblemManager) {
gs.addErrorMessage('Only Problem Managers can close a Major Problem.');
current.setAbortAction(true); // blocks transition
}
} else {
if (!(isTechLead || isProblemManager)) {
gs.addErrorMessage('Only Technical Leads or Problem Managers can close this Problem.');
current.setAbortAction(true); // blocks transition
}
}
}
})(current, previous);
Solved! Go to Solution.
- Labels:
-
Problem Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2025 04:56 AM
You cannot suppress those OOTB messages as they come from platform level.
With your new business rule as well it won't work.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2025 04:56 AM
You cannot suppress those OOTB messages as they come from platform level.
With your new business rule as well it won't work.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2025 05:00 AM
Thanks, so at least I won't have to pull off any more grey hairs over this 🙂