Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Can Incident Tasks update the Incident Activity feed?

nickortiz
Kilo Contributor

I was wonder if it is possible to get an Incident Task to update the parent Incident's activity feed? I would like to see any updates to the task comments or work notes and any changes to the task state.

Since I'm very new to ServiceNow I'm not sure if I am asking this question to the right group of if I was clear in my request, if not I'm happy to provide more detail.

1 ACCEPTED SOLUTION

Ahmed Hmeid1
Kilo Guru

There is no out of the box way to do this.



If you want, you could run a business rule on the incident task with every update, update the parent task.



Example, the condition could be current.work_notes.changes()



Then the code would be:



var gr = new GlideRecord('incident');


gr.addQuery('sys_id', current.parent);


gr.setLimit(1);


gr.query();


if (gr.next()) {


gr.work_notes = current.work_notes;


gr.update();


}


View solution in original post

3 REPLIES 3

Ahmed Hmeid1
Kilo Guru

There is no out of the box way to do this.



If you want, you could run a business rule on the incident task with every update, update the parent task.



Example, the condition could be current.work_notes.changes()



Then the code would be:



var gr = new GlideRecord('incident');


gr.addQuery('sys_id', current.parent);


gr.setLimit(1);


gr.query();


if (gr.next()) {


gr.work_notes = current.work_notes;


gr.update();


}


Thanks for the response I will be testing this in our dev environment and verify that it works for us.


Kalaiarasan Pus
Giga Sage

Create a before update business rule on incident_task table.


Add this script



var updateIncident = current.incident.getRefRecord();


updateIncident.work_notes = current.work_notes;


updateIncident.update();