How to close Work Order using REST API
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-27-2017 03:59 AM
Hello.
I'm trying to close work order via REST API explorer (for testing) .
Using dedicated user for that. With all the roles (admin). Work orders are created with that user also.
I try to use these fields in PUT request to wm_order table:
{"work_notes":"test","state":"3","u_close_code":"1"}
PUT https://instance.com/api/now/table/wm_order/HereIsSysId
I get 200 OK.
The problem is that everything updates but state.
I can't change it at all via PUT. Other fields like close notes modified just fine.
What should i look into?
UPDATE: Work Order Tasks doesnt update State as well with PUT
- Labels:
-
Integrations
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-27-2017 04:31 AM
Hi May,
I suspect process lifecycle for work order is set to "task driven" hence first all related work order tasks has to be closed which automatically set work order to closed complete .
Hit like, Helpful or Correct depending on the impact of the response
Regards
Prashant
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-27-2017 04:58 AM
Thanks for response.
Yes, i tried to close task too.
{"state":"3","close_notes":"testttt","u_close_code":"1"}
State doesn't change, so work order task doesnt close, so work order doesn't close.
Status code 200 and state stays like this in response:
"state": "16",
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-27-2017 04:34 AM
Try to go to the record and close it manually. It will tell you if all the prerequisites for closing the item have been met. You will get a much clearer picture as to what is going on.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-27-2017 04:35 AM
Hi Viktor,
Are you able to close the same work order manually through UI?
It worked for me through REST API, so was wondering something specific to your instance preventing it