
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-13-2020 09:32 AM
I'm using out of the box REST API explorer to simply update a Standard Change record's "state" value from "New (-5)" to "Scheduled (-2)." When I submit the request I get a successful 200 OK response but the change does not happen on the CR. It's like it ignores it. I've tried all the following approaches and none of them work. Any suggestions would be very much appreciated.
- I'm using this method: PATCH /sn_chg_rest/
change/ standard/ {sys_id} - I verified that my Standard change template does not have "state" as read-only. Here is the list of read-only fields when I run StdChangeUtils().getReadOnlyFields() method: "description,backout_plan,short_description,implementation_plan,test_plan,justification,category,business_service,parent"
- When specifying the parameter "state" in the payload, I've tried it as both a query parameter as well as JSON using the body. Neither work. There is a HI KB post that describes that you must use the Label (Scheduled) thus the reason I've tried both "Scheduled" as well as the -2 and "-2" values which is the value for Scheduled. Neither work - fact using the numbers gives an error just as the HI KB post discusses.
- I've ensured that I also called the POST /conflict method as well to prove there is NO scheduling conflict with the CI. That doesn't solve it.
- I've ensured that all required fields are populated with data values before attempting to change the state. That doesn't solve it either.
- I've reviewed the business rules, workflows and Flow Designer objects to look for any running processes that would abort the attempted update and found nothing.
- I've tried updating a different field (e.g., assigned_to and that works). But "state" does not work.
Finally, please see the images below showing the attempt and then results. Again, the question is why is it the state value does not get updated with this REST API call?
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2020 06:06 AM
Hi,
Did you check is there any dictionary override for state field on change_request table for read-only which is blocking the update from API?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-13-2020 10:45 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-13-2020 10:56 AM
Hi

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2020 05:58 AM
Here are a few more tidbits about my scenario.
- If I try this same scenario in my PDI, it works as expected. Therefore, there must be some behavior in our QA instance that is aborting the update for some reason.
- I've reviewed BRs and logs and cannot find any indication as to why this update request is being rejected.
- As a reminder, I've already tried the request using the request body vs query parameters. Neither scenario is working as expected.
Thanks in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2020 06:06 AM
Hi,
Did you check is there any dictionary override for state field on change_request table for read-only which is blocking the update from API?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader