Close a Change Request by REST API
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Anyone know how to move state to close with API?
Thanks,
Jakub
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
@JakubN916150010 We can't move change in any state to Close. OOB, you need to check the 'State Transitions' allowed on the Change Model you are trying to close.
For example, if there is a Change in 'Normal' Model, then the table (sys_state_model.list OR 'State Models' from All menu) will show you a Model entry for 'Normal'.
Inside this records, under related list 'State Transitions' you can find the possible movement of states from Enter to Exist. OOB, for the Change to move to Closed, it should be under 'Review' not from any state.
First you try to do this Patch update using 'REST API Explorer' in Servicnow. When all is good, go for API.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
@JakubN916150010 OOB the Business Rules doesn't update the State to 'Closed' even through an API but Active to 'false' can be done by API.
If you use, just the above playload you mentioned, then the Business Rule is forbidding it.
What exactly are you looking for? You need to close the Changes with API, but it should also respect Models?
If yes, then you use just the above playload and if the API is not table API, then you can enhance the error message with more details.
If No, then setting Active to false should do the thing.
