Get "mandatory" value for the overridden fields in customer_contact

sahilkhanna
Tera Expert

I wanted to retrieve the fields of an object "customer_contact". Based on this response, I got to know the following.

 

ServiceNow objects inherit properties from other parent objects. This way, a child object may just add/modify a few fields. To address this,

  • The "super_class" of the object should be traversed upwards until the "super_class" of the root object is empty.
  • Search for the field attributes in all the "super_class" in the object parent tree.

 

I understand that the child object (contact in our case) can mark an inherited field (email) as mandatory. While I'm able to get this field from "sys_user", I'm not sure if I can know if it is mandatory for "customer_contact" (while it is optional for "sys_user").

Is there a way I can get this from the REST API?

1 ACCEPTED SOLUTION

Chaitanya ILCR
Kilo Patron

Hi @sahilkhanna ,

you can use the table API with below end point to determine if there is any dictionary override on the customer_contact table for the email field using below endpoint
if you get response and 

Override mandatory
 
Mandatory
 
are set as true that means you can determine that the field is mandatory on the customer_contact table with REST API
https://{instance_name}/api/now/table/sys_dictionary_override?sysparm_query=name=customer_contact^element=email

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya

View solution in original post

1 REPLY 1

Chaitanya ILCR
Kilo Patron

Hi @sahilkhanna ,

you can use the table API with below end point to determine if there is any dictionary override on the customer_contact table for the email field using below endpoint
if you get response and 

Override mandatory
 
Mandatory
 
are set as true that means you can determine that the field is mandatory on the customer_contact table with REST API
https://{instance_name}/api/now/table/sys_dictionary_override?sysparm_query=name=customer_contact^element=email

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya