Add work note to RITM

Abhijit Das7
Tera Expert

Hi Everyone,

 

I have a requirement where a reminder functinality should be added to RITM. I have RITM with 5 - day SLA.

1. If "aasigned to" field is not set for 2 days then add a worknote to RITM - "Attention to requirment"

2. If "assigned to" field is not set for more 2 days then add the Group Manager to work note list and add work note : 'Ticket RITM requires attention, as the task has not been assigned".

3. If "assigned to" field is not for 1 more day :

 - then update assignment group to "Special attention group".

 - and add a work note : "Ticket RITM requires attention requires high priority"

 

Can anyone please suggest, how can I achieve above functionalitites.

 

Thanks in advance

3 REPLIES 3

Jaspal Singh
Mega Patron
Mega Patron

Hi,

Do you have notifications on worknotes? If not, there is no value in adding comments in worknotes field. Why not create notifications on Task SLA table with conditions as you are looking for.

Hi @Jaspal Singh ,

 

Is there a way I can achieve above mention functionality. Currently we are just working on adding worknotes. 

 

Thanks in advance

Moin Kazi
Kilo Sage
Kilo Sage

Hi @Abhijit Das7 ,

 

Requirement : 

I have a requirement where a reminder functinality should be added to RITM. I have RITM with 5 - day SLA.

1. If "aasigned to" field is not set for 2 days then add a worknote to RITM - "Attention to requirment"

2. If "assigned to" field is not set for more 2 days then add the Group Manager to work note list and add work note : 'Ticket RITM requires attention, as the task has not been assigned".

3. If "assigned to" field is not for 1 more day :

 - then update assignment group to "Special attention group".

 - and add a work note : "Ticket RITM requires attention requires high priority"

 

Solution:

You can achieve with the help of Scheduled Job

You need to write Schedule which will execute in every 15 minute and update the Work notes , Group Manager or Assignment Group if condition satisfied -

 

Pre requisite - 

You need to create 3 Custom Check Box field on your table so our script execute only 1 time for 1 record you can hide these checkbox from form level because we are only going to use in the script -

Attention Requirement WorkNotes - Checkbox

Group Manager WorkNote List - Checkbox

Special Attention Group - Checkbox

 

Please find the below code, here i have written on incident table but you can adjust according to your table -

These will find out the list of incident which has SLA and start date is more than 1 days, 2 days, or 3 days and Assigned to is empty, SLA is not completed or cancelled once above condition satisfied we will update work notes, work notes list and assignment group.

 

You can adjust script as per your requirement -

attentionToRequirement();
addGroupManagerToWorkNoteList();
assignSpecialAttentionGroup();

function attentionToRequirement() {
    gdt = new GlideDateTime();
    gdt.addDays(-1);
    var taskSla = new GlideRecord('task_sla');
    taskSla.addEncodedQuery("task.numberSTARTSWITHINC^stageINin_progress,achieved,breached,paused^task.assigned_toISEMPTY^start_time<" + gdt);
    taskSla.query();
    while (taskSla.next()) {
        var inc = new GlideRecord('incident');
        inc.addQuery('u_attention_requirement_worknotes', false);
        inc.addQuery('sys_id', taskSla.task);
        inc.query();
        if (inc.next()) {
            gs.addInfoMessage("inc updated: " + inc.number);
            inc.u_attention_requirement_worknotes = true;
            inc.work_notes = "Attention to requirement";
            inc.update();
        }
    }
}

function addGroupManagerToWorkNoteList() {
    gdt = new GlideDateTime();
    gdt.addDays(-2);
    var taskSla = new GlideRecord('task_sla');
    taskSla.addEncodedQuery("task.numberSTARTSWITHINC^stageINin_progress,achieved,breached,paused^task.assigned_toISEMPTY^start_time<" + gdt);
    taskSla.query();
    while (taskSla.next()) {
        var inc = new GlideRecord('incident');
        inc.addQuery('u_group_manager_worknotes_list', false);
        inc.addQuery('sys_id', taskSla.task);
        inc.query();
        if (inc.next()) {
            inc.u_group_manager_worknotes_list = true;
            inc.work_notes_list = inc.assignment_group.manager;
            inc.work_notes = "Ticket INC requires attention, as the INC has not been assigned";
            inc.update();
        }
    }
}

function assignSpecialAttentionGroup() {
    gdt = new GlideDateTime();
    gdt.addDays(-3);
    var taskSla = new GlideRecord('task_sla');
    taskSla.addEncodedQuery("task.numberSTARTSWITHINC^stageINin_progress,achieved,breached,paused^task.assigned_toISEMPTY^start_time<" + gdt);
    taskSla.query();
    while (taskSla.next()) {
        var inc = new GlideRecord('incident');
        inc.addQuery('u_special_attention_group', false);
        inc.addQuery('sys_id', taskSla.task);
        inc.query();
        if (inc.next()) {
            inc.u_special_attention_group = true;
            inc.assignment_group = "cfcc00ff538d521041cb51a0a0490e19"; // Sys Id of Special Attention Group
            inc.work_notes = "Ticket INC requires attention requires high priority";
            inc.update();
        }
    }
}

 

Output: 

MoinKazi_0-1728645767316.png

 

 

Mark MoinKazi_1-1728645807321.pngCorrect if this solves your issue and also mark MoinKazi_2-1728645807320.png Helpful if you find my response worthy based on the impact.

 

Regards

Moin