How to add a work note to an incident via REST Table API?

andriyko
Giga Contributor

Hello,

I am trying to add a work_note to an Incident via REST Table API.

UPDATE /api/now/v1/table/incident/<incident_id>

{'comments': 'test1', 'work_notes': 'test2'}

Now my incident has Additional comment with "test1" text, but does not have a Work notes with "test2" text.

However, I can add a work note via web service with JSONv2.

POST /incident.do?JSONv2&sysparm_action=update&sysparm_query=sys_id=<incident_id>

{'comments': 'test1', 'work_notes': 'test2'}

Why is it possible to add a work note via webservice+JSONv2 but not via Table API?

3 REPLIES 3

Mike Allen
Mega Sage

I was able to do this via the REST API explorer in ServiceNow and soapUI:



Capture.PNG



Capture.PNG


Thank you Mike.



I forgot to mention that my user is not an admin, but has the rest_service role.


I am also able to insert work note with admin user using REST API Explorer, but cannot with the user with the the rest_service role.



At the same time insertion of work note with that user works via web service + JSONv2.



So, I am wondering why it does not work via Table API, but works via web service.


manish123
Giga Guru

Hi All,



I have developed outbound REST API in Eureka version and its working perfect except for work notes and additional comments. Could anyone please let me know how to move it? Below is line of code :-



var comm= inc.comments.getJournalEntry(-1).toString();  


comm=comm.replace(/["']/g, "");  


comm=comm.replace(/[\n*]/g, "");      


comm=   String(comm);



And trying to feed this string to Import set staging table but there its appearing as blank. Any idea where its getting wrong?