Study for the Salesforce Platform Developer Exam. Study with flashcards and multiple choice questions, each question has hints and explanations. Get ready for your exam!

Practice this question and more.


Which field must be populated when inserting new Contact records programmatically?

  1. AccountId

  2. Name

  3. LastName

  4. FirstName

The correct answer is: LastName

When inserting new Contact records programmatically in Salesforce, the field that must be populated is the LastName field. In the context of Salesforce's data model, the LastName is a required field for the Contact object. This is because a Contact represents an individual person, and having a last name is essential for identifying that person within the system. While the other fields listed, such as AccountId, Name, and FirstName, can provide valuable information and may be included depending on the context, they are not mandatory for creating a new Contact record. AccountId ties a Contact to an Account, but it is not necessary if the Contact is created without being associated with any Account. The Name field is a composite field that combines first and last names, but it is typically managed by populating the LastName (and optionally FirstName) fields directly. Thus, to successfully insert a new Contact record, ensuring that LastName is filled is critical for compliance with Salesforce's data integrity rules.