1

We are looking for a ServiceNow API to get all required/mandatory fields and its data, that a user has to provided before creating a new incident.

Refer to this image:

enter image description here

Example:

  • required/mandatory fields --> [Category, Subcategory, Impact, Urgency, etc ...]

  • Data of fields:

    Urgency --> [1: Critical, 2 - High, etc …]

    Category --> [Security, Repair, Remove, ….]

James Z
  • 12,209
  • 10
  • 24
  • 44
TonyTran
  • 87
  • 2
  • 11
  • I found a way to get data of fields under the incident. However, I don't know how to know a field is required or not through an API. – TonyTran Oct 29 '19 at 18:42
  • + https://servertest.service-now.com/api/now/table/sys_choice?sysparm_query=name=incident^element=category + https://servertest.service-now.com/api/now/table/sys_choice?sysparm_query=name=incident^element=subcategory + https://servertest.service-now.com/api/now/table/sys_choice?sysparm_query=name=incident^element=impact + https://servertest.service-now.com/api/now/table/sys_choice?sysparm_query=name=incident^element=urgency – TonyTran Oct 29 '19 at 18:44

1 Answers1

0

Normally this information is stored in the dictionary (right click field label -> dictionary). So you could a request to table sys_dictionary (where table=incident AND mandatory=true) and get the fields from there.

But there are many ways (data policies, business rules, dictionary) and evaluations in servicenow, which will be hard to obtain via REST.

I would advise you to just make a list of fields you want from an incident and make this configurable.

Gordon Mohrin
  • 645
  • 1
  • 6
  • 17
  • Do you mean querying the sys_dictionary table "might" let us obtain the information, but the mandatory fields info could also be somewhere hard to reach via REST as well? –  Nov 20 '19 at 18:42
  • If you want a field to be mandatory you can set it in dictionary, this way it is easy to obtain the info via REST. But you can also set mandatory in a data policy (if user==admin; makeFieldMandatory()), which is hard to obtain via REST (only of you query all data policies and evaluate them in your code) – Gordon Mohrin Nov 21 '19 at 14:10