Copy work notes back to RITM and send email from the RITM to user

Navneet3
Tera Expert

Our team works off the tasks for the requests come in from the portal and when they close the task they put in work notes.

With OOTB, the work notes are not copied to the RITM and the client does not see the work notes.

The requirement is to copy the work notes to RITM so that when the email notification is sent to the client, the work notes are there. Is it possible to accomplish this?

Also, Is is possible to send emails from the task or RITM to the client (just like we can from the Incident)?

 

thank you

1 ACCEPTED SOLUTION

Brad Bowman
Kilo Patron
Kilo Patron

We use an after Update Business Rule on the sc_task table to do this with the Filter Condition

Work notes changes

The script looks like this.

(function executeRule(current, previous /*null when async*/) {
	var ritm = new GlideRecord('sc_req_item');
	if(ritm.get(current.request_item.sys_id)){  
		var curWN = current.work_notes.getJournalEntry(1);
		var curTN = current.number;
		var curAG = current.assignment_group.name;
		if(ritm.work_notes.getJournalEntry(1) == '' || curWN.indexOf(ritm.work_notes.getJournalEntry(1)) <0){
			var newWN = curTN + " - assigned to " + curAG + "\n\n" + curWN;
			ritm.work_notes = newWN;
			ritm.update();
		}
	}
})(current, previous);

We added the task number and assignment group name to the work note to provide further context, and there's a check in there to be sure it doesn't keep copying the same comment to the RITM (because we have a similar business rule running on the sc_req_item table to copy work notes entered into the RITM to each task).

You can definitely trigger email notifications from the task or RITM.  We have one in place on sc_req_item, that I think might be out of box to email the requestor when Additional Comments are added to their RITM (we also have a Business Rule to copy these from tasks to the RITM) since Additional Comments are meant to be customer visible, while Work Notes are meant to be the task processor/assignment group/technical explanation.  Let me know if you don't see this notification definition in your environment and I can lookup the details.

View solution in original post

3 REPLIES 3

Abhishek77
ServiceNow Employee
ServiceNow Employee

You can write a BR on sc_task table as below

 

When:  Before Update
Condition:  current.work_notes.changes() && current.work_notes.indexOf('Work Note added from:') < 0;
//  Note that the condition prevents the note from copying multiple times.


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

	if(current.work_notes.nil()){
		return;
	}	

	else {

		var gr = new GlideRecord('sc_req_item'); 
		gr.addQuery('sys_id',current.request_item);
		gr.query();
		while(gr.next()){
			gr.work_notes = "Work Note added from: " + current.number + " | " +current.request_item.cat_item.name + "\n >>>  " +current.work_notes;
			gr.update();
		}
	}
})(current, previous);

 

and yes you should be able to create emails for RITM same as incident. Refer to https://community.servicenow.com/community?id=community_question&sys_id=189e0f21dbdcdbc01dcaf3231f96...

 

Please mark the response as Helpful/Correct, if applicable. Thanks!

Thank you

Brad Bowman
Kilo Patron
Kilo Patron

We use an after Update Business Rule on the sc_task table to do this with the Filter Condition

Work notes changes

The script looks like this.

(function executeRule(current, previous /*null when async*/) {
	var ritm = new GlideRecord('sc_req_item');
	if(ritm.get(current.request_item.sys_id)){  
		var curWN = current.work_notes.getJournalEntry(1);
		var curTN = current.number;
		var curAG = current.assignment_group.name;
		if(ritm.work_notes.getJournalEntry(1) == '' || curWN.indexOf(ritm.work_notes.getJournalEntry(1)) <0){
			var newWN = curTN + " - assigned to " + curAG + "\n\n" + curWN;
			ritm.work_notes = newWN;
			ritm.update();
		}
	}
})(current, previous);

We added the task number and assignment group name to the work note to provide further context, and there's a check in there to be sure it doesn't keep copying the same comment to the RITM (because we have a similar business rule running on the sc_req_item table to copy work notes entered into the RITM to each task).

You can definitely trigger email notifications from the task or RITM.  We have one in place on sc_req_item, that I think might be out of box to email the requestor when Additional Comments are added to their RITM (we also have a Business Rule to copy these from tasks to the RITM) since Additional Comments are meant to be customer visible, while Work Notes are meant to be the task processor/assignment group/technical explanation.  Let me know if you don't see this notification definition in your environment and I can lookup the details.