User to Bulk Assign tickets from list view:
User Story/Scenario:
The user needs the ability to assign tickets in bulk from the list view. Bulk assigning tickets to the wrong assignment group may lead to data discrepancies.
The user login to the ServiceNow.
Navigate to All ==> Incident ==> Open.
When viewing incidents/tickets in the group cart, the user should be able to bulk assign tickets to team members.
Users will filter assignment group and assign tickets only to team members within that group. Bulk assigning tickets to the wrong assignment group may lead to data discrepancies.
Development Process:
Role required: admin
Requirement Analysis:
We will utilize the Incident table for implementing the user story.
We will create a Business Rule on the target table (specifically in Incident table), with a type of 'Before Update.'
The Business Rule will perform the following:
Verify if the new value in the 'assigned to' field is a member of the current assigned group.
If the new user in the 'assigned to' field is a member of the assigned group, allow the update to proceed.
If the new user in the 'assigned to' field is not a member of the assigned group, trigger an error message.
If the new user in the 'assigned to' field is not a member of the assigned group, don't allow the update and keep the existing 'assigned to' value unchanged. And show an error message.
Development Steps:
Business Rule:
The user login to the ServiceNow.
Navigate to All ==> Incident ==> All
Open any incident, and right click on Form banner => Configure => Business Rules
Click New to create new business rule.
Provide the below details:
Name : Bulk Assign tickets from List
Table : Incident [incident]
Active : True
Advance : True
When (Sections: When to run) : before
Update : True
Script (Sections: Advanced) : Replace the below code in script section/field.
(function executeRule(current, previous /*null when async*/ ) {
if (previous.assigned_to != current.assigned_to) {
var gr_member = new GlideRecord('sys_user_grmember');
gr_member.addQuery('group', current.assignment_group);
gr_member.addQuery('user', current.assigned_to);
gr_member.query();
if (!gr_member.next()) {
gs.addErrorMessage("Error: " + current.getDisplayValue("assigned_to") + " is not member of group : " + current.getDisplayValue("assignment_group"));
current.setAbortAction(true);
}
}
})(current, previous);
Click Submit to save the business rule.