Salesforce Certified Platform Developer II — Question 86

The Contact object has a custom field called "Zone." Its data type is "Text" and field length is 3.
What is the outcome after executing the following code snippet in the org?
List<Contact> contactsToBeInserted=new List<Contact>(); Contact contactInstance= new Contact(LastName='Smith',
Department='Tech', Zone_c='IAD'); contactsToBeInserted.add(contactInstance); contactInstance= new Contact
(LastName='Sm1th', Department='Tech', Zone_c='PITT'); contactsToBeInserted.add(contactInstance); Database.insert
(contactsToBeInserted,true);

Answer options

Correct answer: D

Explanation

The correct answer is D because the Zone field has a maximum length of 3 characters, and the value 'PITT' exceeds this limit, causing a DML exception. Options A, B, and C incorrectly suggest that the inserts can succeed despite the violation of the field length restriction.