How to close Work Order using REST API

viktormay
Kilo Contributor

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

12 REPLIES 12

Well, you can try to close it in background scripts with setWorkflow(false).   If you can close it there, you can close it in Scripted REST.   I don't know all the relationship roadblocks between the two records, and I certainly don't know your own instance, but there has to be a way to do it via script.


meghanareddy206
Tera Contributor

Hi 

I'm having the same issue, it might be because of the state flows. Is there anyway we can change the state through API?

 

wc99
Tera Contributor

@meghanareddy206@gmail, are you able to figure it out? Guess the state is control by the state flow. Couldn't get pass this by using Put in REST API. The work notes is empty even though I passed in the work notes in the request body