Required Field Not Throwing Error in REST API

Priya84
Mega Contributor

Hi,

I have required/mandatory fields in Customer_contact table. When i try to create (POST) a contact via REST API it is creating record with status 201. But  i have a required field account in customer_contacts table.

 

Please refer below imagefind_real_file.png

 

Below is the contact which i have created via REST API.

find_real_file.png

Below image is the response for contact creation.

find_real_file.png

 

 

My question is, Why error not Shown when i try to post a contact via REST API, though a required field is not sent in request payload. 

1 ACCEPTED SOLUTION

glad it worked . 

kindly mark my answer as correct and close this thread

if you have further question , kindly open new thread .

 

 

View solution in original post

18 REPLIES 18

why did you write ui policy on "sys_dictionary" table, it has been written on "sys_dictionary" table that's why you were not seeing it.

 

can you write the UI Policy on the table where you are dealing with the records and form UI and then you will convert it to data policy 

I am not trying to write UI policy newly. I want to apply existing UI policies to data policy. Thats all.Because my target is i want to show all validations done in CRM UI in my intergration using REST API.

I am new to service now.Please correct me if anything is wrong.

 

i would suggest dont change the OOTB one,

 

i am assuming here you have a table where you are creating a record using REST API, so kindly create data policy directly on that table and make those columns mandatory using data policy . 

I have added 4 fields in data policy account,phone,title,u_colortype.

When account is sent as empty i am getting error.

find_real_file.png

 

find_real_file.png

For remaining added fields not getting error while createing contact in REST API.

find_real_file.png

 

Please tell What i have done wrong.

 

 

i tested at my end and i can see if i am not passing any value in the mandatory field, it's giving me an error. 

if i pass the value on those mandatory column it is allowing me to create it. 

 

find_real_file.png

 

 

can you check again those data policy , are they applied for phone,title,u_colortype