The Zurich release has arrived! Interested in new features and functionalities? Click here for more

REST Calls for Change Task

sam_hennessy
Kilo Explorer

I am trying to automate creating change requests and change tasks from those requests.   I can create a change request using the REST.   I can also create the change task using rest, but when I do, it does not have the parent change request I created.   I am passing the data for the change request (and the change task will not create at all if the change request parent is not there), but it does not seem to link up.   The response I get back even says the change request field is empty.   Does anyone have any thoughts?

Data to create the change task:

{

    "upon_approval": "proceed",

    "change_request":{

            "link": "https://blackhdevpov.service-now.com/api/now/table/task/f2983a4b0f7042001687d33be1050e35",

            "value": "f2983a4b0f7042001687d33be1050e35"

    },

    "expected_start": "2015-06-24 22:14:03",

    "impact": "3",

    "urgency": "3",

    "description": "Routine Change Task",

    "priority": "3",

    "due_date": "2015-06-26 22:14:03",

    "state": "1",

    "short_description": "Routine Change Task",

    "u_category": "Release Plan",

    "active": "true",

    "correlation_id": "",

    "correlation_display": ""

}


Info back from rest call (empty change_request field is in bold below):

{"result":{"skills":"","upon_approval":"proceed","change_request":"","location":"","expected_start":"2015-06-24 22:14:03","close_notes":"","impact":"3","urgency":"3","correlation_id":"","group_list":"","description":"Routine Change Task","priority":"3","sys_domain":{"link":"https://blackhdevpov.service-now.com/api/now/table/sys_user_group/global","value":"global"},"sys_mod_count":"0","work_notes_list":"","follow_up":"","closed_at":"","sla_due":"","sys_updated_on":"2015-06-26 22:23:56","parent":{"link":"https://blackhdevpov.service-now.com/api/now/table/task/{link=https://blackhdevpov.servi","value":"{link=https://blackhdevpov.servi"},"work_end":"","number":"CTASK0010283","closed_by":"","work_start":"","business_duration":"","activity_due":"","correlation_display":"","due_date":"","active":"true","assignment_group":"","knowledge":"false","made_sla":"true","state":"1","user_input":"","sys_created_on":"2015-06-26 22:23:56","reassignment_count":"0","u_requested_for":"","opened_at":"2015-06-26 22:23:56","order":"","short_description":"Routine Change Task","sys_updated_by":"devops","upon_reject":"cancel","approval_history":"","work_notes":"","calendar_duration":"","approval":"not requested","sys_id":"db260b4b0f7042001687d33be1050e65","sys_created_by":"devops","assigned_to":"","cmdb_ci":"","opened_by":{"link":"https://blackhdevpov.service-now.com/api/now/table/sys_user/1439b6460fb731001687d33be1050e86","value":"1439b6460fb731001687d33be1050e86"},"sys_class_name":"change_task","u_category":"Release Plan","watch_list":"","escalation":"0","contact_type":"","time_worked":"","comments":""}}

1 REPLY 1

sanjeev22
Kilo Explorer

it can be solved by setting the parent id   and change request of the change_task


{"parent":"cb49f3dd2bc82a00d545bf5de8da157b","change_request":"cb49f3dd2bc82a00d545bf5de8da157b"}



Thanks.


Sanjeev