Creating a Change Management Request with REST API

Harry16
Kilo Contributor

I’m working on a project to try and automate some release tasks within my team. The end goal is to be able to fully create a ServiceNow Change Request via a third party application.

 

Currently ServiceNow’s REST API functionality allows users to create a Standard Change Request  based on a template, however does not let the user change these fields:

- Description

- Backout plan

- Test plan

- Implementation plan

(https://developer.servicenow.com/app.do#!/rest_api_doc?v=newyork&id=c_change-management-api)

 

Which almost always vary from request to request. I can’t understand why these fields cannot be modified from the original template when creating the Change Request via REST. Is there any method of being able to modify these fields - either during or after the creation process from REST or any other API protocol.

 

3 REPLIES 3

Henry Thomas1
Tera Expert

Hi Harry,

If you're running into issues using the regular Table API, you may want to consider creating a Scripted REST API via System Web Services -> Scripted Web Services -> Scripted REST API.

Here you can create your own custom endpoint and processing script that can parse your Request Body and create a Change Request using GlideRecord.

See the below link for some example scripts

https://docs.servicenow.com/bundle/newyork-application-development/page/integrate/custom-web-service...

John Reilly1
Kilo Contributor
Hi Henry, I must say I share Harry's puzzlement at the API not allowing you to provide the Description etc fields I was delighted that there seems to be another way to do it. However, I've had a read of the link you shared and I'm afraid I'm not too sure how to use that to create a change request with the description field. Would you be able to expand on what you meant please? I'd be very grateful indeed! 😊

Hi John,

Harry's question was specifically related to creating Standard Changes from a template, the fields listed as being unable to be modified by the API are the same fields that cannot be modified when creating a Standard Change normally, as the template should hold these values and they should not change unless the template itself changes.

That being said, looking at the /sn_chg_rest/change/standard endpoint it does not seem to mention those same fields as being off-limits for a PATCH http request, so you could potentially create a Standard Change using the POST method (which will then return the sys_id of your new change) and plug that sys_id into a subsequent PATCH request, to update those fields you require.

All this is coming from the below doco

https://docs.servicenow.com/bundle/orlando-application-development/page/integrate/inbound-rest/conce...