Salesforce
PDII · Question #257
PDII Question #257: Real Exam Question with Answer & Explanation
Sign in or unlock PDII to reveal the answer and full explanation for question #257. The question stem and answer options stay visible for context.
Question
Refer to the code snippet below: As part of an integration development effort, a developer is tasked to create an Apex method that solely relies on the use of foreign identifiers in order to relate new contact records to existing Accounts in Salesforce. The account object contains a field marked as an external ID, the API Name of this field is Legacy_Id_c. What is the most efficient way to instantiate the parentAccount variable on line 02 to ensure the newly created contact is properly related to the Account?
Exhibit
Options
- AAccount parentAccount = new Account(Legacy_Id_c = externalIdentifier);
- BAccount parentAccount = [SELECT Id FROM Account WHERE Legacy_Id_c
- CAccount parentAccount = [SELECT Id FROM Account WHERE Legacy_Id_c = :externalIdentifier];
- DAccount parentAccount = new Account();
Unlock PDII to see the answer
You've previewed enough free PDII questions. Unlock PDII for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.
