Incident Comments or work notes added by REST API not visible on Incident screen.

Dheeraj N
Kilo Contributor

Hi Team,

I am using ServiceNow REST API & trying to add comments or work_notes in existing Incident by following REST API. As a result, it's getting success & inserting in DB properly however when I am trying to see the newly added comment or work_notes in respective Incident in Service Now GUI, it's not visible. Can someone help me here to fix this?

REST API End point : https://devxxxxx.service-now.com/api/now/table/sys_journal_field?element_id=44791b8c37121300eb30dcc773990e0b

Request Json: 

{

"name": "incident",
"element_id": "44791b8c37121300eb30dcc773990e0b",
"value": "Internal Note 4 by REST API",
"element": "work_notes"
}

API Status : 201 Created

Refer following ServiceNow Incident screen as well.

find_real_file.png

7 REPLIES 7

asifnoor
Kilo Patron

What David mentioned above is absolutely correct. The activity formatter queries the records from sys_history_line, sys_history_set tables.  Also it is not advisable for us to insert the data directly. Tomorrow if any new table is added by SN in the future to normalize the records, the API setJournalEntry will automatically takes care of it. But if we are inserting it manually, then we need to update our code. 

Hence use the available API wherever possible.

Mark the comment as a correct answer and helpful if it helps.

Duke
Kilo Explorer

Can you specify the user along with the work_notes?

If you use setJournalEntry() you can specify the user as a second argument in the function call. eg:

current.work_notes.setJournalEntry('add worknotes here', 'add user_name here');