How to update SC Task and RITM When requested for of a request update any comments in the Request?

sruthig
Tera Expert

How to update SC Task and RITM When requested for of a request update any comments in the Request?

Or

Is it possible to send notification to Assigned to user of catalog task when requested for user update any comments in the request?

Please suggest how can I notify to Assigned to/ Assignment group members of a task when a request work notes or additional comments updated by requested for of a request?

 

Regards,

Sruthi 

4 REPLIES 4

Brad Bowman
Kilo Patron
Kilo Patron

We have this business rule in place to update the active Catalog Tasks whenever a comment is added to an RITM.  This runs after Update on sc_req_item when Additional comments changes.  You could try to add work notes to this, or create a second rule.

(function executeRule(current, previous /*null when async*/) {
var sctask = new GlideRecord('sc_task');
    sctask.addQuery('request_item', current.sys_id);
    sctask.addQuery('active', 'true');
    sctask.query();
    while(sctask.next()){
        var curAC = current.comments.getJournalEntry(1);
        sctask.comments = curAC;
        sctask.update();
    }
        
})(current, previous);

Now that the catalog task has been updated, that should trigger your notification to update assigned to when a task of theirs has been updated. 

Would it be possible to get this same script but for the other way around?  So if a comment is entered at SCTASK level as an additional comment, it rolls up to the RITM as an additional comment.

This Business Rule would run after Update on the sc_task table when Additional comments changes

(function executeRule(current, previous /*null when async*/) {
	var ritm_gr = new GlideRecord('sc_req_item');
	ritm_gr.addQuery('sys_id', current.request_item);
	ritm_gr.query();
	if(ritm_gr.next()) {		
		ritm_gr.comments = current.comments.getJournalEntry(1);
		ritm_gr.update();
	}
})(current, previous);

Brad Bowman
Kilo Patron
Kilo Patron

Have you had a chance to try this solution?