How to change the state of work order task by Rest API?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-21-2018 02:57 PM
Hi Everyone
I am currently new in Service Now and working on Work Order. I have set up a work order template which contain 4 dependency tasks and i want to change the state of task by api. I come to know that after assigned task to a user state change to 17, when user accept it, then state change to 18 and when it start working on the task it change to 19 and at last when task is complete it change back to 3.
So i am finding a way through which i change it state after user accept, like to 18 via REST API. When i sending the data via REST API i am getting response 200 but state remain same 16. I have also tried to close the task via api by sending data in body:
{"work_notes":"close task","state":"3","u_close_code":"1"} but again i have received response 200 ok but there is no change in state it is still 16.
I am using a put request by using a url: https://xxxxxxxx.service-now.com/api/now/v1/table/wm_task/ae02059adbf213002471dec0cf96192d
and username and password is also authorized + also have itil role through which he can change the state, could any one please update me is any business rule is blocking it?
Also in UI i am able to accept, cancel and start the task, but issue appears only when i requesting it via REST API.
Any help would be appreciate!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-25-2018 06:37 AM
Also when i send work_notes in web request then notes are update but only this creating issue is state, it is unable to update from 17 to 18 (work order task)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-25-2018 06:39 AM
I don't know enough about the work order process to say why it's not updating, but it could be a BR, it could be a State Model. Have you checked the logs?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-25-2018 06:48 AM
2018-06-25 06:48:33
Information Basic authentication failed for user: midserveradmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-25-2018 06:57 AM
also i have tried to check State Management > State Models where as there is no state model installed yet. I am currently using the default states.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-25-2018 06:17 AM
You might want to try a POST instead of a PUT.