- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-30-2015 02:34 AM
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
Solved! Go to Solution.
- Labels:
-
Integrations
-
User Interface (UI)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-03-2015 07:08 AM
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)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-30-2015 04:55 PM
Are you on Fuji? IF so, navigate to System Web Services > REST API Explorer. This is a very useful tool that builds the REST calls for you. It even sends them so you can test against your instance. I was able to set a reference field drop down to --None-- via the API.
I used a 'PUT' call, and the payload I sent was:
{'field_name':''}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-30-2015 10:20 PM
Hi,Zachary,
Sorry I didn't realise I was replying to myself. Please see my reply below.
regards,
Haotian.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-30-2015 06:24 PM
Hi,Zachary,
Thanks for your reply. Could you help me to verify the field value is indeed changed when you do that? Because when I do the exact same thing, I get a 200 OK but the field value never really changed. Here is an example of what I did using the REST API Explorer:
And this is the response, you can see the 'date_format' is not set to null:
And yes, I am on Fuji.
regards,
Haotian

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-31-2015 10:13 AM
What table is that on? I'm curious if there is an ACL in place that prevents this from being changed? Or perhaps a data policy?