Add incident work notes and comments to incident task form and notification

tmaxey1
Giga Contributor

Good morning,

I have been tasked with putting the incident comments and work notes onto the incident task notification email. I found a script that I believe can be modified for the task, but I thought I'd see if there was a better solution out there in the community before I committed to this path.

https://community.servicenow.com/community?id=community_question&sys_id=4f8bc761db9cdbc01dcaf3231f96...

Thank you in advance!

Tyler

1 ACCEPTED SOLUTION

kristenankeny
Tera Guru

I would just reference via the available variables in the notification set up on the What it will contain tab - open variables, hit the + next to incident, then select Comments and work notes - this will automatically put it into the notification.

View solution in original post

9 REPLIES 9

Ashutosh Munot1
Kilo Patron
Kilo Patron

Hi,

 

Please tell me one thing. Do you want to update it on incident form or notification on that incident form.


Also when is that incident task notification triggered.

 

Thanks,
Ashutosh Munot

Ideally, it'd update when I create the task. Right now, our frontline support owns incidents and tasks our upstream teams with tasks; the upstreams would like to see what's come before when they get the incident_task notification.

Community Alums
Not applicable

You could use something like this:

 

var journalString = "";   
    var actObject = new GlideRecord('sys_journal_field');   
    actObject.addQuery('element_id', <incident.sys_id>);   
    actObject.query();   
    journalString = '';  
     
    while( actObject.next() ) {  
         
        journalString += actObject.sys_created_on + ' - ' +  
            actObject.sys_created_by + ' (' + actObject.element + ')\n' +  
            actObject.value + '\n\n';  
         
    }  

The output of 'journalString' would contain all comments and worknotes currently belonging to the Incident.

Obviously, you'd need to modify this a bit to fit your needs. 

Hope that helps!

 

Tim

Tim, this looks great. Thank you!