Work note when associating a record

joshmorris
Tera Guru

Hi all,

 

We use interactions and when we associate an interaction to an incident for example is it possible to get a work note into the ticket it has been linked to saying IMS...... has been linked? 

3 ACCEPTED SOLUTIONS

J Siva
Tera Sage

Hi @joshmorris 
Yes. It's possible.
Create one After Business rule on interaction_related_record table like below.

JSiva_0-1745487112548.png

 

JSiva_1-1745485502357.png

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

	var task_rec = new GlideRecord('task');
	task_rec.get(current.task.sys_id);
	task_rec.work_notes = current.task.getRefRecord().number +' has been associated with '+current.interaction.getRefRecord().number;
	task_rec.update();

})(current, previous);

Hope this helps.
Regards,

Siva

 

 

View solution in original post

Ankur Bawiskar
Tera Patron
Tera Patron

@joshmorris 

you can use flow designer for this with no scripting

Flow Triggers when Insert on "interaction_related_record" and updates the INC

something like this but please enhance

interaction related record work notes.gif

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

@joshmorris Yes, you can. PFB script and make changes as required.

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

	// Add your code here

	var task_rec = new GlideRecord('task');
	task_rec.get(current.task.sys_id);
	task_rec.work_notes = current.task.getRefRecord().number +' has been associated with '+current.interaction.getRefRecord().number+'\n'+'Short description: '+current.interaction.getRefRecord().short_description;
	task_rec.update();

})(current, previous);

Output:

JSiva_0-1745493430296.png

 

View solution in original post

6 REPLIES 6

J Siva
Tera Sage

Hi @joshmorris 
Yes. It's possible.
Create one After Business rule on interaction_related_record table like below.

JSiva_0-1745487112548.png

 

JSiva_1-1745485502357.png

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

	var task_rec = new GlideRecord('task');
	task_rec.get(current.task.sys_id);
	task_rec.work_notes = current.task.getRefRecord().number +' has been associated with '+current.interaction.getRefRecord().number;
	task_rec.update();

})(current, previous);

Hope this helps.
Regards,

Siva

 

 

This worked thank you, is it possible to tweak the script so the work note says that its been linked like it does now but then on another line it pulls through the description of the interaction?

@joshmorris Yes, you can. PFB script and make changes as required.

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

	// Add your code here

	var task_rec = new GlideRecord('task');
	task_rec.get(current.task.sys_id);
	task_rec.work_notes = current.task.getRefRecord().number +' has been associated with '+current.interaction.getRefRecord().number+'\n'+'Short description: '+current.interaction.getRefRecord().short_description;
	task_rec.update();

})(current, previous);

Output:

JSiva_0-1745493430296.png

 

Thank you