Need ability to restrict P1/P2 Incident escalation/creation of tickets
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2023 07:24 AM
If a user is not part of a particular group they should be restricted from selecting Impact and Urgency options that would calculate a high priority creating a P1 or P2 Incident. How can this be achieved?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2023 07:37 AM - edited 10-25-2023 07:46 AM
Hi @Christian22A ,
You need to create a before insert update BR in servicenow & paste the below code
(function executeBefore(current, previous) {
// Check if the user is not part of the specific group
if (!gs.getUser().isMemberOf('Group Name')) {//Enter proper group name
gs.addErrorMessage('Only Users of this group are allowed to raise a P1/P2 incidents');
current.setAbortAction(true);
}
})(current, previous);
Thanks,
Danish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2023 07:46 AM
I came across an article that I thought was similar, but I was unsure. The resolution stated "Use an onLoad client script and a GlideAjax script include to check the roles or groups that were given and restrict Impact and Urgency options that calculate a high priority from being selected using "g_form. removeOption". What is your opinion on this approach?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2023 07:56 AM
Hi @Christian22A ,
I think we can go with BR which will be a quicker way as well as whenever anyone tries to update or insert a record it will show an error message & cancel update.
Going via client script is also correct but over there in order to find whether logged in user is part of a certain group or not we need to have a script include which needs to be called using GlideAjax & based upon the values returned from the script include make the fields read only or something like that.
If u go with client script u need to use On load script.
both the ways we can achieve the solution.
Thanks,
Danish