- 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
‎08-03-2015 01:16 AM
That's on sys_user table. I've tried to deactive all data policies but still to no avail. I'm not sure whether this could be an ACL issue as I use same credential for both RESTclient and on the serviceNow UI.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-31-2015 02:10 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-03-2015 02:39 AM
Hi,Venkat,
Thanks for your reply. I noticed you got a 201 Created, does it mean you are doing a create instead of modify? I can set the field to none during creation, but not when I try to modify an exsiting user with the field already with some other value. Could you kindly verify on your instance if that's the case?
regards,
Haotian
- 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
‎08-03-2015 05:51 PM
The import set API is a great option. I've hacked some solutions together that way. Gives you the full power of server side scripting. In my example I was setting a reference choice list to --None--, but I didn't try with a string based choice list.