- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2025 07:34 AM
I have retrieved the fields of the Contacts form (customer_contact) using the REST API. Below is the request and response below.
Request
{{instanceUrl}}/api/now/table/sys_ui_element?sysparm_query=sys_ui_section.view.name=ess&sys_ui_section.name=customer_contact&sysparm_fields=element
Response
{"result":[{"element":"preferred_language"},{"element":"email"},{"element":".begin_split"},{"element":"first_name"},{"element":"time_zone"},{"element":"phone"},{"element":"user_name"},{"element":"last_name"},{"element":".split"},{"element":"mobile_phone"},{"element":".end_split"},{"element":"title"},{"element":"account"},{"element":"notification"}]}
The response has 10 elements (excluding 4 split sections)
I want to get the attributes of these elements. Below is the API request and response.
Request
{{instanceUrl}}/api/now/table/sys_dictionary?sysparm_query=name=customer_contact&sysparm_fields=element,column_label
Response
{"result":[{"column_label":"Sys ID","element":"sys_id"},{"column_label":"","element":""},{"column_label":"Account","element":"account"}]}
I can get only 3 out of 10 elements, and only 1 of the 3 belongs to the result returned in the "sys_ui_element" response, i.e. "account".
How can I get all the customer_contact fields in "sys_dictionary" response? Or is there any other API/table I need to get this information from?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2025 01:19 AM
No worries @sahilkhanna., glad I can help.
To answer your followup questions specifically.
There is an field/column against a table labelled 'Extends table' (Database name: 'super_class') which if populated indicates which table the current table is extended from.
Another pointer, specifically related with CSM (Customer Service Management) and other scoped applications, this is known as a scoped app and there is an available direct API's available for this table 'sn_customerservice'.
API endpoint: {instanceURL}/api/sn_customerservice/case
Re the mandatory fields on extended table. In ServiceNow threes a concept known as a 'Dictionary override' whereby for columns/fields which are inherited, you can override and control the behavior at the required table level. As you've described, it is possible to make fields mandatory on a child level which may not or are not mandatory on a parent level.
To help others (and for me to gain recognition for my efforts), please mark this response correct by clicking on Accept as Solution and/or Kudos.
Thanks, Robbie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2025 07:59 AM
Hi @sahilkhanna ,
try with below api.
{{instanceUrl}}/api/now/table/sys_dictionary?sysparm_query=name=customer_contact&sysparm_fields=element,column_label,data_type,reference
{{instanceUrl}}/api/now/table/sys_db_object?sysparm_query=name=customer_contact
-------------------------------------------------------------------------
If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.
Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay
-------------------------------------------------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2025 01:26 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2025 09:06 AM
@Runjay Patel, I hit the APIs you sent and got the response for both. However, I couldn't understand the use of it as there was no explanation provided on its usage and significance. 😊
I got the needed information and explaination from Robbie's reply.
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2025 08:15 AM
Hi @sahilkhanna,
The 'Contact' table (Table name: 'customer_contact') is an extension of the 'User' table (table name: 'sys_user') and only has 3 columns (2 of which are default - Sys ID and the Collection column). The only column on this table is the Account column or field.
This is the reason why your receiving the said response using the table API calling the sys_dictionary table.
The API response is actually actually correct.
You'll have to reference the sys_user table for the inherited fields you're after.
To help others (and for me to gain recognition for my efforts), please mark this response correct by clicking on Accept as Solution and/or Kudos.
Thanks, Robbie