Restrict the access for creating P!/P2 incident for some groups
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-16-2023 12:42 AM
I have requirement that only servicedesk and incident management team should be able to create P1/P2 incidents.
So I have created the display business rule and onchange client script for priority field. But now the servicedesk people also not able to create P1 incidents. the issue is the alert popup will appear for everyone irrespective of their group.
 
 
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-16-2023 04:10 AM
Hi @Yakshitha ,
Hope you are doing great.
To address this, we can modify the existing scripts and add additional logic to achieve the desired behavior.
- Display Business Rule: The display business rule controls the visibility of the priority field.
(function executeRule(current, previous /* Add any other parameters */) {
var group = gs.getUser().getMyGroups();
if (!(group.contains('Service Desk') || group.contains('Incident Management'))) {
current.priority.setDisplayValue('3');
}
})(current, previous /* Add any other parameters */);
​
- OnChange Client Script:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue == '') {
return;
}
var group = g_user.getMyGroups(); // Get the groups of the currently logged-in user
if (!(group.contains('Service Desk') || group.contains('Incident Management'))) {
if (newValue == 1 || newValue == 2) {
g_form.setValue('priority', '3'); // Set priority to P3 for non-authorized users
alert('Only the Service Desk and Incident Management teams can select P1/P2 priorities.'); // Display an alert message
}
}
}
​
Regards,
Riya Verma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-16-2023 06:25 AM
Hi Riya,
Getting below error.