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 get all comments of incident using rest api

poojasomani
Kilo Contributor

Hi,

I want to get all comments (Additional Comments field on UI) of specific incident using rest api.

Which rest API should I use?

1 ACCEPTED SOLUTION

Hi Pooja,



If you don't want to split the string and you need to use the Table API then the best way to get the comments in a list is to make a call on the sys_journal_field passing in sysparm_query with the element_id which is the specific incident sys_id. And if you only want comments and not work notes pass in the element being "comments".



For example:


//<your instance name>.service-now.com/api/now/table/sys_journal_field?sysparm_query=element_id=d71f7935c0a8016700802b64c67c11c6^element=comments



That would return a response with each comment as its own item.



If you want work notes just change the element to be work_notes. If you want both work notes and comments just give an element_id.



I hope that helps.


View solution in original post

16 REPLIES 16

The answer I gave was 5 years ago. There are different versions you can select from but have you tried what @justin.tuma suggested and just go directly to the table and set sysparm_display_value to true?

Balakrishnan N
Kilo Contributor

Due to older version I couldn't get.... while using proper version value I can get all comments and worknotes.

 

Regards,

Bala N