Assign Change task based on the On-call schedule
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2023 09:11 AM
Hi - We have a ask from the users to assign the change task to their group and Assigned to he group member who is on-call at that moment.
Currently , there is already a task that get assigned to the group based on a check box on the change form. However, it is being assigned manually , we want to automate the process and assign to the user who is on-call from that specific group
- Labels:
-
ITSM
-
ITSM: General
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2023 10:21 AM
var CreatePlannedTaskForOnCall = Class.create();
CreatePlannedTaskForOnCall.prototype = {
initialize: function() {},
createTaskForOnCall: function(groupSysId) {
var rota = new OnCallRotation();
rota.who(groupSysId);
var userName = rota.getPrimaryUserName();
var userID = rota.getPrimaryUser();
var task = new GlideRecord('planned_task'); // Modify the table name if needed
task.initialize();
task.short_description = 'Planned task for on-call person';
task.assigned_to = userID;
task.insert();
return task.sys_id;
},
type: 'CreatePlannedTaskForOnCall'
};
var groupSysId = ''; // Replace with actual group sys_id
var createPlannedTask = new CreatePlannedTaskForOnCall();
var taskSysId = createPlannedTask.createTaskForOnCall(groupSysId);
gs.info('Planned task created for on-call person. Task sys_id: ' + taskSysId);