- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2023 08:15 AM
Hi All,
I am writing to inquire about the availability of an API that allows us to retrieve all the mandatory fields from the Incident and Request tables in our ServiceNow instance.
It would be helpful for us to programmatically access information about the mandatory fields in these tables.
Please let us know if such an API exists, and if possible, provide us with the necessary details to access like Roles to access it as I am trying to call from POSTMAN (grant_type = password) using the User details which is present in ServiceNow Instance which is not having any Roles.
Thank you in advance !!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2023 01:55 AM
The API to fetch out the mandatory fields is through the table API in which you needs to call "Sys_dictionary" table.
Add Query parameter such as mandatory should be true and name which is a parameter for table to be incident or problem.
Add this as query parameter as sysparm_query name=incident^mandatory=true.
Below are the screenshot from postman:
This is how Final URL looks Like : https://<instancename>.service-now.com/api/now/table/sys_dictionary?sysparm_query=mandatory=true^nam...
Need to Provide Admin role to the user credentials that you are calling for Oauth where grant_type = password.
Please Mark it Correct, If it Resolves your Query.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2023 11:14 AM
Hi @gtripathi2612,
ServiceNow does not have such api to get mandatory fields data instead you can use table api on sys_dictionary table toget all mandatory fields data
https://<instance>.service-now.com/api/now/table/sys_dictionary?sysparm_query=name=incident^mandatory=true
1. Make sure your POSTMAN user has permissions to access the “sys_dictionary” table.
2. Use the ServiceNow Table API to query the “sys_dictionary” table for mandatory fields.
3. You’ll need to make GET requests to specific API endpoints for each table you’re interested in (e.g., “Incident” or “Request”).
4. Authenticate in POSTMAN using the user’s credentials.
5. The response will contain information about mandatory fields, which you can filter to extract the field names.
6. Note that the exact API details may vary based on your ServiceNow configuration and permissions. Adjust as needed.
Please make this as accepted solution and helpful if it serves your purpose.
Thanks,
Anand
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2023 01:55 AM
The API to fetch out the mandatory fields is through the table API in which you needs to call "Sys_dictionary" table.
Add Query parameter such as mandatory should be true and name which is a parameter for table to be incident or problem.
Add this as query parameter as sysparm_query name=incident^mandatory=true.
Below are the screenshot from postman:
This is how Final URL looks Like : https://<instancename>.service-now.com/api/now/table/sys_dictionary?sysparm_query=mandatory=true^nam...
Need to Provide Admin role to the user credentials that you are calling for Oauth where grant_type = password.
Please Mark it Correct, If it Resolves your Query.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2023 01:25 AM
In this even though I see 2 fields as mandatory in UI, I don't get this fields name in Response when I hit the API from POSTMAN.
Any reason though if aware?
Also is it possible to add/update/mandate fields later point of time ?
If yes is it possible to fetch through this same API ?
Thanks again in advance 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2023 03:08 AM
What are the fields you are looking for ?