Newbie question: querying change_request table with REST API returns only a single cmdb_ci link

smilingjoefissi
Kilo Contributor

Fairly new to ServiceNow, so please excuse me if I've overlooked something obvious. Starting from a pretty clean Jakarta developer instance, I've added a couple of CIs to an existing Change Request:

find_real_file.png

But when I attempt to retrieve this from the REST endpoint https://dev34098.service-now.com/api/now/table/change_request?sysparm_limit=1, I get only a single cmdb_ci link, which is the original one (see below). The cmdb_ci property exposes a JSON object structure, rather than an array which looks ominous. Does anyone know if it's possible to get the entire list this way, or will I have to query a different table, perhaps referencing my parent sys_id?

Many thanks for reading,

Joe

=====================

{
  "result": [
  {
  "parent": "",
  "reason": "",
  "made_sla": "false",
  "backout_plan": "Current prod environment to be snapshotted with VmWare\n prior to change.\n ",
  "watch_list": "",
  "upon_reject": "",
  "sys_updated_on": "2017-05-31 12:42:23",
  "type": "normal",
  "conflict_status": "",
  "approval_history": "",
  "number": "CHG0000001",
  "test_plan": "Multi-User testing on Sunday night",
  "cab_delegate": "",
  "sys_updated_by": "admin",
  "opened_by": {
  "link": "https://dev34098.service-now.com/api/now/table/sys_user/6816f79cc0a8016401c5a33be04be441",
  "value": "6816f79cc0a8016401c5a33be04be441"
  },
  "user_input": "",
  "requested_by_date": "2016-12-01 00:00:00",
  "sys_created_on": "2016-11-24 22:12:50",
  "sys_domain": {
  "link": "https://dev34098.service-now.com/api/now/table/sys_user_group/global",
  "value": "global"
  },
  "state": "-5",
  "sys_created_by": "admin",
  "knowledge": "false",
  "order": "",
  "phase": "requested",
  "closed_at": "2017-05-26 09:46:25",
  "cmdb_ci": {
  "link": "https://dev34098.service-now.com/api/now/table/cmdb_ci/a9c0c8d2c6112276018f7705562f9cb0",
  "value": "a9c0c8d2c6112276018f7705562f9cb0"
  },
  "delivery_plan": "",
  "impact": "3",
  "active": "true",
  "review_comments": "",
  "work_notes_list": "",
  "business_service": "",
  "priority": "3",
  "sys_domain_path": "/",
  "time_worked": "",
  "cab_recommendation": "",
  "expected_start": "",
  "production_system": "false",
  "opened_at": "2016-11-24 22:12:50",
  "review_date": "",
  "business_duration": "",
  "group_list": "",
  "requested_by": {
  "link": "https://dev34098.service-now.com/api/now/table/sys_user/5137153cc611227c000bbd1bd8cd2007",
  "value": "5137153cc611227c000bbd1bd8cd2007"
  },
  "work_end": "",
  "change_plan": "Backup dataset, image current system, reinstall previous\n release, test\n ",
  "phase_state": "open",
  "approval_set": "",
  "cab_date": "",
  "work_notes": "",
  "implementation_plan": "",
  "end_date": "2017-05-19 01:00:00",
  "short_description": "Rollback Oracle Version",
  "close_code": "",
  "correlation_display": "",
  "delivery_task": "",
  "work_start": "",
  "assignment_group": "",
  "additional_assignee_list": "",
  "outside_maintenance_schedule": "false",
  "description": "Performance of the Siebel SFA software has been severely\n degraded since the upgrade performed this weekend.\n\n We moved to an unsupported Oracle DB version. Need to rollback the\n Oracle Instance to a supported version.\n ",
  "on_hold_reason": "",
  "calendar_duration": "",
  "std_change_producer_version": "",
  "close_notes": "",
  "sys_class_name": "change_request",
  "closed_by": {
  "link": "https://dev34098.service-now.com/api/now/table/sys_user/6816f79cc0a8016401c5a33be04be441",
  "value": "6816f79cc0a8016401c5a33be04be441"
  },
  "follow_up": "",
  "sys_id": "a9e9c33dc61122760072455df62663d2",
  "contact_type": "phone",
  "cab_required": "false",
  "urgency": "3",
  "scope": "3",
  "company": "",
  "justification": "",
  "reassignment_count": "",
  "review_status": "",
  "activity_due": "",
  "assigned_to": {
  "link": "https://dev34098.service-now.com/api/now/table/sys_user/681b365ec0a80164000fb0b05854a0cd",
  "value": "681b365ec0a80164000fb0b05854a0cd"
  },
  "start_date": "2017-05-18 23:00:00",
  "comments": "",
  "approval": "requested",
  "sla_due": "",
  "comments_and_work_notes": "",
  "due_date": "",
  "sys_mod_count": "21",
  "on_hold": "false",
  "sys_tags": "",
  "conflict_last_run": "",
  "escalation": "0",
  "upon_approval": "",
  "correlation_id": "",
  "location": "",
  "risk": "2",
  "category": "Software",
  "risk_impact_analysis": ""
  }
  ]
}

1 ACCEPTED SOLUTION

Jochen Geist
ServiceNow Employee
ServiceNow Employee

The cmdb_ci is a field / attribute on the change_request table. This value is returned for your request.



The Affected CIs are stored in a separate table (Task_ci) which you would have to query individually. The query is task=*change request sys_id*


View solution in original post

2 REPLIES 2

Jochen Geist
ServiceNow Employee
ServiceNow Employee

The cmdb_ci is a field / attribute on the change_request table. This value is returned for your request.



The Affected CIs are stored in a separate table (Task_ci) which you would have to query individually. The query is task=*change request sys_id*


Thanks Jochen, that's enabled me to get to the links and thence to the CIs themselves which solves my problem.