Update State Field in Catalog Task with REST API

bradd_
Mega Contributor

Hey guys,

This is kind of a newb question, but I'm having issues updating the State field for a catalog task. The user I am working with has the REST API permissions as well as Admin permissions. We created a custom state that we plan on using as a 'trigger' for our Orchestration tool to read and automate against (i.e. provision server in VMware, provision user in AD, etc.).

URL: https://<instance>.service-now.com/api/now/v1/table/sc_task/<sys_id>

Method: PUT

Payload: {"State":"3"}

Is there something I'm missing? Am I trying to update a system protected field?

1 ACCEPTED SOLUTION

bradd_
Mega Contributor

Thanks to everyone who offered some feedback and suggestions. I have figured out the issue with a partner that we are using for a redesign of our instance and it looks like a misguided ACL was placed on the table that was not allowing me to change the state to a '3'. Through further testing we narrowed down the issue to that specific choice as we could change the state to other choices in the list. Removing the ACL allowed me to successfully update the state to a '3'. Again, thanks for all your help.


View solution in original post

14 REPLIES 14

Stefan Baldhof1
Kilo Guru

Hi Brad,



after playing around with the REST API Explorer I think you simply have to define the payload as following:



    {"state":"3"}



Use lower case characters for the field names.



Regards,


Stefan


Thanks for the idea Stefan. I tried it using lowercase instead of uppercase and I get the same result.


Okay, so let's try to narrow it down step by step:



  • What is the exact issue you're running in?
  • Does this same issue also occur when using the API Explorer?
  • Could you please provide a screenshot of the field definition (choices of the state field)


Regards,


Stefan


The issue I am running in to is that I am attempting to update the State field in the sc_task table via REST API calls. I've tried using a REST client I have, as well as the built-in ServiceNow API Explorer and the state is not updating to the integer I am passing it to. The sc_task table has the 'Allow access to this table via web services' enabled and the field has an ACL that is wide open, and admin has access to write to that field. I have successfully used a PUT operation to update the comments section of the particular CTASK and I working on, just unable to update that CTASKS State field.



There are 92 Choices for that particular field for the 'State' Dictionary entry.


Hm, okay. But not all 92 choice values are for the sc_task table. In the list of choices only look at those for the sc_task table by using the "Show Matching" option from the context menu. Maybe you first have to personalize the list view to see the "Table" column.