- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2023 05:39 AM
Hi Community,
I have 2 Assignment group named as "Software" and "Hardware". and both group managers have major_incident_manager role.
My requirement is :- if i select assignment group as Software. then only the Manager of Assignment group was able to promote the incident after proposed as a major incident candidate. How to achieve it...
Problem is that both managers will see the option for promote the incident as a major incident.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2023 06:50 AM
Hi @Deepak Shaerma,
In your case, you need to abort the action if the Hardware assignment group manager is promoting an incident that is assigned to the Software assignment group and vice versa.
One issue that we will face with hiding UI action is Software Assignment Group Manager can directly create a major incident using the "Major Incident" create module. So better to abort the action if the wrong assignment group manager is promoting a major incident.
In order to achieve this follow the below steps:-
Step 1:-
Create a Display Business Rule:-
Business rule Code:-
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var assignment_group_sysIds = ['9a52796e979e6110faa9737e6253aff3','b162b1ae979e6110faa9737e6253afbb'];
//Sys_id's of software and hardware assignment groups
var group_obj = new GlideRecord('sys_user_group');
group_obj.addQuery('sys_id','IN',assignment_group_sysIds.join());
group_obj.addQuery('manager',gs.getUserID());
group_obj.query();
if(group_obj.next())
{
g_scratchpad.group_id = group_obj.sys_id;
}
})(current, previous);
Step 2:-
Create an OnSubmit Client script:-
On Submit Client Script Code:-
function onSubmit() {
//Type appropriate comment here, and begin script below
var action_name = g_form.getActionName();
if(action_name == 'sysverb_mim_accept'){
if (g_form.getValue('assignment_group') == g_scratchpad.group_id) //Software Group SysID
{
return true;
}
else
{
g_form.addErrorMessage('Invalid selection of assignment Group');
return false;
}
}
}
Please mark helpful and accept the solution if it helped you.
Regards,
Suma.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2023 08:58 PM
hello @Deepak Shaerma
In your case, I think we can modify the condition of that UI action to achieve your case.
Best Regards,
Long
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2023 06:50 AM
Hi @Deepak Shaerma,
In your case, you need to abort the action if the Hardware assignment group manager is promoting an incident that is assigned to the Software assignment group and vice versa.
One issue that we will face with hiding UI action is Software Assignment Group Manager can directly create a major incident using the "Major Incident" create module. So better to abort the action if the wrong assignment group manager is promoting a major incident.
In order to achieve this follow the below steps:-
Step 1:-
Create a Display Business Rule:-
Business rule Code:-
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var assignment_group_sysIds = ['9a52796e979e6110faa9737e6253aff3','b162b1ae979e6110faa9737e6253afbb'];
//Sys_id's of software and hardware assignment groups
var group_obj = new GlideRecord('sys_user_group');
group_obj.addQuery('sys_id','IN',assignment_group_sysIds.join());
group_obj.addQuery('manager',gs.getUserID());
group_obj.query();
if(group_obj.next())
{
g_scratchpad.group_id = group_obj.sys_id;
}
})(current, previous);
Step 2:-
Create an OnSubmit Client script:-
On Submit Client Script Code:-
function onSubmit() {
//Type appropriate comment here, and begin script below
var action_name = g_form.getActionName();
if(action_name == 'sysverb_mim_accept'){
if (g_form.getValue('assignment_group') == g_scratchpad.group_id) //Software Group SysID
{
return true;
}
else
{
g_form.addErrorMessage('Invalid selection of assignment Group');
return false;
}
}
}
Please mark helpful and accept the solution if it helped you.
Regards,
Suma.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2023 10:04 AM
Hi @Deepak Shaerma ,
I would suggest you abort the submission if the Software group manager tries to promote a major incident that is assigned to the Hardware Group.
There is one drawback if we hide the UI actions accordingly, the Software group manager can directly create a major incident and assign it to the Hardware Group. Just to avoid this try the below approach,
Follow the below Steps:-
Step 1:-
Create a Display Business rule:-
Business Rule Code:-
(function executeRule(current, previous /*null when async*/) {
var assignment_group_sysIds = ['9a52796e979e6110faa9737e6253aff3','b162b1ae979e6110faa9737e6253afbb'];
//Replace the above Sys Ids with your Software and Hardware Assignment Group
var group_obj = new GlideRecord('sys_user_group');
group_obj.addQuery('sys_id','IN',assignment_group_sysIds.join());
group_obj.addQuery('manager',gs.getUserID());
group_obj.query();
if(group_obj.next())
{
g_scratchpad.group_id = group_obj.sys_id;
}
})(current, previous);
Step 2:-
Create an OnSubmit Client Script:-
OnSubmit Client Script:-
function onSubmit() {
//Type appropriate comment here, and begin script below
var action_name = g_form.getActionName();
if(action_name == 'sysverb_mim_accept'){
if (g_form.getValue('assignment_group') == g_scratchpad.group_id) //Software Group SysID
{
return true;
}
else
{
g_form.addErrorMessage('Invalid selection of assignment Group');
return false;
}
}
}
Please mark my answer as helpful, if it helps!!