Salesforce Platform Developer I (legacy) — Question 115

A developer needs to save a List of existing Account records named myAccounts to the database, but the records do not contain Salesforce Id values. Only the value of a custom text field configured as an External ID with an API name of Foreign_Key__c is known.
Which two statements enable the developer to save the records to the database without an Id? (Choose two.)

Answer options

Correct answer: A, C

Explanation

Option A is correct because it uses the upsert statement correctly with the External ID. Option C is also correct as it employs Database.upsert with the correct parameters for the External ID. Options B and D are incorrect because they do not follow the correct syntax for upserting records using External IDs.