The CreatorCon Call for Content is officially open! Get started here.

Remove sys_domain field and/or logic from Table API results

RikV
Tera Expert

Hi,

 

We are not using domain seperation, so the sys_domain field is not relevant to us at all. However, it keeps showing up in our table api results for CSM tables. Normally i wouldnt mind and just ignore it, but i noticed whenever the sys_domain field is included in results my query takes around 15-20 seconds longer, so i would really like to get this out of the default set of fields (which seem to be sys_id, sys_domain, sys_class_name) the table API returns. Anyone any direction where to do this? 

6 REPLIES 6

Omkar Mone
Mega Sage

Hello Rik,

To replicate this behavior, I used the REST API Explorer in my PDI on the Incident table. The response does include the sys_domain field, even if its value is set to "global."

To exclude this field, you can specify the exact fields you need in the API response instead of retrieving all the fields from the Table API. This can be achieved using the sysparm_fields parameter.

Here's an example:

https://XXX.service-now.com/api/now/table/incident?sysparm_fields=number,short_description

OmkarMone_0-1735354130463.png

 

Using this approach will not only exclude unnecessary fields like sys_domain but also enhance performance.

 

Hope this helps.

Thanks for the answer. I am aware of the parameter to only include specific fields, which is how i found out excluding the field makes the query 15-20 seconds faster. But the issue lies in that the table api will be used and queried by our customers, and for security reasons i want to keep strict control of the set of fields being returned, so it never returns data its not allowed to expose when doing a normal query (without specified fields). But the sys_domain fields keeps showing up even though i dont have it specified anywhere to be returned and seems to be part of the default set of returned values (sys_id, sys_domain, sys_class_name). It is no problem this info is exposed as its not containing any restricted data, but its slowing down the query massively for some reason, which is why i want to cut it out.