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

Mike Patel
Tera Sage

Try using incident table something like below

PATCH https://xxx.service-now.com/api/now/table/incident/44791b8c37121300eb30dcc773990e0b

{"work_notes":"test2"}

Jayanta
Kilo Contributor

I also ran into this issue. I have a integration with SNOW where comments gets added via Rest API using the payload that Dheeraj used. It is not working now. 

Interestingly when i fetch the comments for a incident using below API it shows the comments added via the API.

SERVER/api/now/table/sys_journal_field?sysparm_query=element=comments&element_id=SYSID

 

The solution suggested by Mike is working for now. Just wondering It this a API issue. The original API, is it deprecated?

Dubz
Mega Sage

I've seen this issue when inserting comments into the sys_journal_field via business rule so it's not a REST API issue. I think the activities formatter queries the sys_history or sys_history_line tables to return activities so just adding a record in to the sys_journal_field table isn't enough. This is why it is recommended that you use the getJournalEntry() and setJournalEntry() API methods when interacting with journal entries.

Jayanta
Kilo Contributor

This used to work earlier. Our integration worked for a long time since 2016. Anyhow point is noted. Thanks for the response.