- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2025 02:59 AM
Below is the API request I use to create a Contact.
curl --location 'https://{instanceUrl}.service-now.com/api/now/table/customer_contact' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer DiJ8YZG3S60-...A9FUxg' \
--data-raw '{
"first_name": "Ophelia",
"last_name": "Kulas"
}'
The contact is created. However, the request should have resulted in an error as the mandatory "email" and "account" fields aren't in the API request.
The fields are blank when I open the created contact in the ServiceNow UI.
When I Update the contact from the UI without filling in the mandatory fields, I get the error "The following mandatory fields are not filled in: Account, Email".
Could you help me with the questions below?
- Is there a reason why the API ad UI behave differently?
- When the mandatory fields are missing, can the API return an error instead of creating the contact?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2025 03:20 AM
Hi @sahilkhanna
REST API will only give you the mandatory fields missing error if those fields are marked as mandatory in the dictionary record or a data policy is being enforced on them. In your case, probably, the Account and Email fields are being made mandatory via UI Policy that's why no error being thrown. You can refer below discussion to understand it better and derive a solution for your problem:
Thanks and Regards
Amit Verma
Please mark this response as correct and helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-19-2025 06:59 AM
Hope you are doing good.
Did my reply answer your question?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-19-2025 06:59 AM
Hope you are doing good.
Did my reply answer your question?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader