How to set choice to "-- None --" using REST API?

haotian
Kilo Explorer

Hi, all,

I'd like to set the value of a user(sys_user) field, which is defined using a dropdown list of choices with "-- None --". Now I can find out the value of all the choices in the list and set the field to them using their value, except I can't find the value for "-- None --". By pulling user data and read the value in filter query,   I can see the value of --None-- is in fact "" or a NULL, but I've tried setting the field with value as "","null","NULL","none" with both "Update" amd "Patch" method, but nothing works.

If i change the display value of --None-- by setting the label to something and value of option to NULL_OVERRIDE, I can update the field to new option by setting the attribute value as"NULL_OVERRIDE". So I think this also imply the -- None-- value is NULL, but I just can't set the value using "NULL".

So, does anyone how I could set a field to "-- None --" using REST API?

Thanks in advance.

Haotian

1 ACCEPTED SOLUTION

derycklio
Mega Expert

According to the FAQ #16 (https://hi.service-now.com/kb_view.do?sysparm_article=KB0534905), it seems not to be possible if the field is a choice field.



I wonder if you can work around the issue by using the Import Set API (http://wiki.servicenow.com/index.php?title=Import_Set_API#gsc.tab=0) or Scripted Web Services (http://wiki.servicenow.com/index.php?title=Scripted_Web_Services#gsc.tab=0) instead of the Table API. Then you may be able to create your own Transform Map rule to set the value back to null. (Haven't had time to try it yet)


View solution in original post

11 REPLIES 11

HI,Zachary,



Thanks for the help. Really appreciated.



regards,


haotian


Hi,Deryck,



Thank you so much for the information. I'll look into the methods.



regards,


Haotian