View Live Feed from a RITM

michelle kirk
Kilo Guru

Hi

 

Is there a way to see the number of RITM that have been updated by users by Live Feed ?

 

The reason being when a user updates the RITM its doesnt up date the SCTASK so unless the fulfiller remembers to look at the RITM they can get missed. 

1 REPLY 1

Brian Lancaster
Tera Sage

Since the task also does not update the RITM with comments I have 2 business rules. One on the RITM and the on the tasks. They are designed so that they don't cause a loop of just updating so change the code at your own risk. Both are a before update rule with a conditions of additional comments changes.

 

RITM BR:

(function executeRule(current, previous /*null when async*/ ) {

    // Add your code here
    if (!(current.comments.toString().toLowerCase().indexOf('comments from task:') > -1)) {//Checking for wording added to comments created from the catalog task is not there. This tells me that I need to write the comments to the catalog task. If the wording is there then I do not write the comments to the task.
        var str = "Comments from RITM: \n";
		var gr = new GlideRecord ('sc_task');
		gr.addQuery('request_item', current.getValue('sys_id'));
		gr.addQuery('active', true);
		gr.query();
		while (gr.next()){
			gr.comments = str + current.comments.getJournalEntry(1);
			gr.update();
		}
    }

})(current, previous);

Task BR:

(function executeRule(current, previous /*null when async*/ ) {

    // Add your code here
    if (!(current.comments.toString().toLowerCase().indexOf('comments from ritm:') > -1)) {//Check to see if working added to the comments on the RITM are not there. This tells me that I need to write the comments to the RTIM. If they are there then these comments came from the RITM and should not be written.
        var str = "Comments from TASK: \n";
        var gr = new GlideRecord('sc_req_item');
        gr.addQuery('sys_id', current.getValue('request_item'));
        gr.addQuery('active', true);
        gr.query();
        if (gr.next()) {
            gr.comments = str + current.comments.getJournalEntry(1);
            gr.update();
        }
    }

})(current, previous);