- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-16-2015 02:16 AM
Hi,
I want to get all comments (Additional Comments field on UI) of specific incident using rest api.
Which rest API should I use?
Solved! Go to Solution.
- Labels:
-
Integrations
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2015 06:39 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2015 06:39 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2015 11:03 PM
Thanks Chris Burks. This is the API I was looking for.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-14-2017 01:15 PM
I know this is a really old thread but I just came across this solution after receiving the answer Chris provides when I logged a HI ticket. By setting the sysparm_display_value=true in your query string, the comments, comments_and_work_notes, etc. fields will contain the values.
{
"result": [
{
"comments": {
"display_value": "14.03.2017 13:06:10 - Justin Tuma (Additional comments)\nyour comments here\n\n",
"value": ""
},
"comments_and_work_notes": {
"display_value": "14.03.2017 13:06:10 - Justin Tuma (Additional comments)\nyour comments here\n\n",
"value": ""
},
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-14-2017 08:26 AM
I also just now came across this, thank you justin.tuma Agreed, no need to query the journal if all you care about is a single string of the journal stack for that ticket/sys_id, you can just query against the incident table.
Setting sys_parm_display_value to 'true' will return just display value, and setting to 'all' will return both display value and value as indicated in Justin's sample above. Setting of 'false' (default, if not supplied) will only return the value.
Thanks,
Daniel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-19-2020 04:20 AM
Hi Chris,
I referred the above API url which gives me only 2 comments whereas I have 3 comments in SNow UI. It did not get the recent one seems.
And here I didn't mention the element so it should give both comments and work notes isn't it? but I got only work notes....
Please help me to get all work notes and comments...
Regards,
Bala N