How to get Work Notes and Comments via ServiceNow API

If you will call ServiceNow Table API for Incident or any other Task table the you will not get worknotes and comments directly in the response and field will have empty data in response.


In order to retrieve details of work notes and comments you have add a parameter which will automatically show all the work notes and comments in the response.


Standard API EndPoint| Without Work notes and Comments in response

If you will use standard ServiceNow API without any parameter then you will not get work notes in the response.

API End Point :

https://dev63008.service-now.com/api/now/table/incident/cb90e641db5c10101d94f26b68961961


Method : GET



Response:

{
  "result": {
    "parent": "",
    "made_sla": "true",
    "caused_by": "",
    "watch_list": "",
    "upon_reject": "cancel",
    "sys_updated_on": "2020-04-25 04:48:44",
    "child_incidents": "0",
    "hold_reason": "",
    "approval_history": "",
    "number": "INC0010215",
    "resolved_by": "",
    "sys_updated_by": "admin",
    "opened_by": {
      "link": "https://dev63008.service-now.com/api/now/table/sys_user/6816f79cc0a8016401c5a33be04be441",
      "value": "6816f79cc0a8016401c5a33be04be441"
    },
    "user_input": "",
    "sys_created_on": "2020-04-19 07:41:09",
    "sys_domain": {
      "link": "https://dev63008.service-now.com/api/now/table/sys_user_group/global",
      "value": "global"
    },
    "state": "1",
    "sys_created_by": "admin",
    "knowledge": "false",
    "order": "",
    "calendar_stc": "",
    "closed_at": "",
    "cmdb_ci": "",
    "delivery_plan": "",
    "impact": "3",
    "active": "true",
    "work_notes_list": "",
    "business_service": "",
    "priority": "5",
    "sys_domain_path": "/",
    "rfc": "",
    "time_worked": "",
    "expected_start": "",
    "opened_at": "2020-04-19 07:40:57",
    "business_duration": "",
    "group_list": "",
    "work_end": "",
    "caller_id": {
      "link": "https://dev63008.service-now.com/api/now/table/sys_user/62826bf03710200044e0bfc8bcbe5df1",
      "value": "62826bf03710200044e0bfc8bcbe5df1"
    },
    "reopened_time": "",
    "resolved_at": "",
    "approval_set": "",
    "subcategory": "",
    "work_notes": "",
    "short_description": "TEST 3",
    "close_code": "",
    "correlation_display": "Acer",
    "delivery_task": "",
    "work_start": "",
    "x_26123_snow_ebond_bonded": "false",
    "assignment_group": {
      "link": "https://dev63008.service-now.com/api/now/table/sys_user_group/0a52d3dcd7011200f2d224837e6103f2",
      "value": "0a52d3dcd7011200f2d224837e6103f2"
    },
    "x_26123_snow_ebond_vendor_ticket": "INC0010231",
    "additional_assignee_list": "",
    "business_stc": "",
    "description": "",
    "calendar_duration": "",
    "close_notes": "",
    "notify": "1",
    "sys_class_name": "incident",
    "closed_by": "",
    "follow_up": "",
    "parent_incident": "",
    "sys_id": "cb90e641db5c10101d94f26b68961961",
    "contact_type": "",
    "reopened_by": "",
    "incident_state": "1",
    "urgency": "3",
    "problem_id": "",
    "company": {
      "link": "https://dev63008.service-now.com/api/now/table/core_company/227cdfb03710200044e0bfc8bcbe5d6b",
      "value": "227cdfb03710200044e0bfc8bcbe5d6b"
    },
    "reassignment_count": "0",
    "activity_due": "",
    "assigned_to": "",
    "severity": "3",
    "comments": "",
    "approval": "not requested",
    "sla_due": "",
    "comments_and_work_notes": "",
    "due_date": "",
    "sys_mod_count": "2",
    "reopen_count": "0",
    "sys_tags": "",
    "escalation": "0",
    "upon_approval": "proceed",
    "correlation_id": "3eb23c03db1010101d94f26b689619f4",
    "location": "",
    "category": "inquiry"
  }
}

Updated API EndPoint With Worknotes and Comments in response


In order to get work notes in the response you have to add a parameter in URL of API sysparm_display=true.


API End Point :

https://dev63008.service-now.com/api/now/table/incident/cb90e641db5c10101d94f26b68961961?sysparm_display_value=true


Method : GET


Response:

{
  "result": {
    "parent": "",
    "made_sla": "true",
    "caused_by": "",
    "watch_list": "",
    "upon_reject": "cancel",
    "sys_updated_on": "2020-04-25 04:48:44",
    "child_incidents": "0",
    "hold_reason": "",
    "approval_history": "",
    "number": "INC0010215",
    "resolved_by": "",
    "sys_updated_by": "admin",
    "opened_by": {
      "link": "https://dev63008.service-now.com/api/now/table/sys_user/6816f79cc0a8016401c5a33be04be441",
      "value": "6816f79cc0a8016401c5a33be04be441"
    },
    "user_input": "",
    "sys_created_on": "2020-04-19 07:41:09",
    "sys_domain": {
      "link": "https://dev63008.service-now.com/api/now/table/sys_user_group/global",
      "value": "global"
    },
    "state": "1",
    "sys_created_by": "admin",
    "knowledge": "false",
    "order": "",
    "calendar_stc": "",
    "closed_at": "",
    "cmdb_ci": "",
    "delivery_plan": "",
    "impact": "3",
    "active": "true",
    "work_notes_list": "",
    "business_service": "",
    "priority": "5",
    "sys_domain_path": "/",
    "rfc": "",
    "time_worked": "",
    "expected_start": "",
    "opened_at": "2020-04-19 07:40:57",
    "business_duration": "",
    "group_list": "",
    "work_end": "",
    "caller_id": {
      "link": "https://dev63008.service-now.com/api/now/table/sys_user/62826bf03710200044e0bfc8bcbe5df1",
      "value": "62826bf03710200044e0bfc8bcbe5df1"
    },
    "reopened_time": "",
    "resolved_at": "",
    "approval_set": "",
    "subcategory": "",
    "work_notes": "2020-04-24 21:48:36 - System Administrator (Work notes)\nTest for Worknotes\n\n2020-04-19 00:41:09 - System Administrator (Work notes)\nsdsdsdd\n\n",
    "short_description": "TEST 3",
    "close_code": "",
    "correlation_display": "Acer",
    "delivery_task": "",
    "work_start": "",
    "x_26123_snow_ebond_bonded": "false",
    "assignment_group": {
      "link": "https://dev63008.service-now.com/api/now/table/sys_user_group/0a52d3dcd7011200f2d224837e6103f2",
      "value": "0a52d3dcd7011200f2d224837e6103f2"
    },
    "x_26123_snow_ebond_vendor_ticket": "INC0010231",
    "additional_assignee_list": "",
    "business_stc": "",
    "description": "",
    "calendar_duration": "",
    "close_notes": "",
    "notify": "1",
    "sys_class_name": "incident",
    "closed_by": "",
    "follow_up": "",
    "parent_incident": "",
    "sys_id": "cb90e641db5c10101d94f26b68961961",
    "contact_type": "",
    "reopened_by": "",
    "incident_state": "1",
    "urgency": "3",
    "problem_id": "",
    "company": {
      "link": "https://dev63008.service-now.com/api/now/table/core_company/227cdfb03710200044e0bfc8bcbe5d6b",
      "value": "227cdfb03710200044e0bfc8bcbe5d6b"
    },
    "reassignment_count": "0",
    "activity_due": "",
    "assigned_to": "",
    "severity": "3",
    "comments": "",
    "approval": "not requested",
    "sla_due": "",
    "comments_and_work_notes": "",
    "due_date": "",
    "sys_mod_count": "2",
    "reopen_count": "0",
    "sys_tags": "",
    "escalation": "0",
    "upon_approval": "proceed",
    "correlation_id": "3eb23c03db1010101d94f26b689619f4",
    "location": "",
    "category": "inquiry"
  }
}

399 views0 comments