logo

NJP

Script::. How to update a change_request

Import · Feb 23, 2018 · article

Also since you are targeting one record with "objChangeRequest.addQuery("sys_id", "bfb14d900fa0d74032854d6a42050e38");

There really isn't any reason to use orderByDesc("sys_created_on");

  • Also you should be wrapping your next() method in an if or while statement to prevent any unneeded code from running.

Also you should mentioned that using,

objChangeRequest.setWorkflow(false);

objChangeRequest.autoSysFields(false);

Will prevent other Business rules from running and system fields not being updated. To avoid new developers from being mislead or confused by the use of these methods.

image

View original source

https://www.servicenow.com/community/developer-articles/script-how-to-update-a-change-request/ta-p/2330388