Update fields inside a reference field with rest API (Similar to updatewithreferences() command).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-23-2019 02:19 PM
Hello.
I need to update fields within a reference record by rest API (Similar to updatewithreferences() command ).
I tried to send this body by rest API update to the incident table but with no success:
{"assigned_to.email":"example@gmail.com"}
Any suggestion?
- Labels:
-
Integrations
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-23-2019 06:30 PM
Are you calling ServiceNow's table API?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-24-2019 01:01 AM
Yes. A rest call via rest api explorer, and editing the JSON with the raw tab .

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-24-2019 06:36 AM
Here's an old discussion where someone was trying to set location.latitude and location.longitude in a table API PUT call:
At the end they state "this is not currently possible with the Table API."
If that is still the case, you could create your own inbound REST API call and set as many table records as needed with GlideRecord queries.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-24-2019 08:21 AM
Yes, That what I did. the problem is that I only get the fields name and value and not the table.
Unfortunately, dot walking does not work with setValue() , for example gr.setValue ('assigned_to.email', 'my@email.com') doesn't work even if you call updatewithreferences() in the end.
To bypass that problem, I created a string that contains the script syntax, for example, it's generating these commands: gr.assigned_to.email= 'my@email.com'; and gr.updatewithreferences() and run it with evaluate script command.