New SLA record creation on Assignee Change
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2025 03:22 PM
Hello Community
I am trying to create new TASK SLA records whenever Assignee on the Task changes and if Task already contains an existing SLA.I have written the following business rule on Task ,I see Task sla record getting inserted but I don't see TASK SLA defnition field getting populated.I have configured to query the existing TASK sla defnition and copy the same sla defnition on to the new SLA record ,but it is not populating.
Can someone advise.This is the code.
(function executeRule(current, previous /*null when async*/) {
// check if assignee has changed
if(current.assigned_to!=previous.assigned_to){
//check if task already has a Task SLA
var slaGR = new GlideRecord('task_sla');
slaGR.addQuery('task', current.sys_id);
slaGR.query();
if(slaGR.hasNext()){
//create a new Task SLA
var newSLA = new GlideRecord('task_sla');
newSLA.initialize();
newSLA.task = current.sys_id;
newSLA.sla = slaGR.getValue('sla');
newSLA.start_time = new GlideDateTime();
newSLA.stage = 'In Progress';
//newSLA.
newSLA.insert();
}
}
})(current, previous);
0 REPLIES 0