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.

How to access work notes from REST API

jhughen
Kilo Contributor

Can anyone tell me how to access the work notes or comments for a given incident through the REST API?

6 REPLIES 6

Mike Allen
Mega Sage

It is in a different table, sys_journal_field.   Element ID in that table is the sys_id of the corresponding record.   Just grab the sys_id and do a second get.


Ok, If I query sys_journal_field I can get all the comments and work_notes for a incident, also if I post to sys_journal_field I can add comments or work notes and if I again query sys_journal_fields the added comments are there but If I retrieve the incident through the web UI I cant see the work_notes or comments that I posted through the REST api, how do I get these to show up in the web UI?


Thank you Mike

 

This works for me:

 

https://<instance-name>/api/now/table/sys_journal_field?sysparm_query=element_id=<task_sys_id_here>

 

However, I'm having a bit of trouble figuring out how to obtain the USER who created a particular journal_field (ie. comment or work note). The 'sys_created_by' field seems to refer to a generic system name, and not the actual user who entered a particular journal update.

 

Is there a different table where this information is recorded?

 

Thanks.

Harsh Vardhan
Giga Patron

hi John,



open the properties "glide.ui.permitted_tables"   and mention the table sys_journal_field there and then in rest api explorer you will able to see the table.