How to fetch change task details associated with a change request ?

learner12
Kilo Contributor

Hi All,

I am trying to get the details of a change request usign the JSON service.

Url : https://<instance name>.service-now.com/change_request.do?XML&sysparm_query=number=CHG000abc&display...

In the response , I am not able to find any change task details. Kindly let me know how to get the change task details assiciated with a change request.

Thanks!

13 REPLIES 13

Chuck Tomasi
Tera Patron

Your URL points to the change_request table. If you are looking for the change tasks, it will take a query something like this:



https://<instance name>.service-now.com/change_task.do?XML&sysparm_query=change_request=CHANGE_SYS_ID&displayvalue=true



I should also note that you mentioned the JSON service, but you are requesting an XML payload. Try either the REST API with the proper headers (application/json) or using JSON in place of XML in the URL.


Thank you Chuck for replying.


The XML is a copy paste mistake. I was trying both the XML and JSONv2 option.



We are actually trying to create a program to fetch the details of a change request based on its number and all its associated ctasks and their details.


Is there a way to get the details of all the ctasks associated with   a change request based on its(change request) number ?



Thanks!


learner12
Kilo Contributor

Hi All,



Can anyone please provide your inputs ?


Hi Neetu,



You either need to get the change in one fetch and the related change tasks in a second request or think about writing a scripted REST API. That gives you ultimate control over what is accepted as parameters to ServiceNow and what is returned.



https://docs.servicenow.com/bundle/istanbul-servicenow-platform/page/integrate/custom-web-services/c...