表示モード
画像位置
文字位置
理解度の自動記録
Q1Salesforce Platform Developer Advanced
Q1. A company’s business system runs an Apex controller and a Visualforce page that filter and display records based on the combination of picklist values a user selects.
Under some conditions, the display takes a long time, while under other conditions an exception occurs stating “Maximum view state size limit exceeded.”
Which action should the developer take to improve this situation?
Show answer
Correct answer: C. Use a StandardSetController or a SOQL LIMIT in the Apex controller to reduce the number of records displayed at once.
The key points of this question are that holding a large number of records at once bloats the view state and that the display processing itself slows down due to the large number of records retrieved.Visualforce has a defined upper limit on view state size, and for list displays, managing the record set with a StandardSetController is effective.
Therefore, reducing the number of records handled at once with a SOQL LIMIT or a StandardSetController is the appropriate action.
Option B is counterproductive, because transient indicates that a value is not retained in the view state, so removing it could actually worsen the problem.
Options A and D are insufficient as a direct solution to this question.
StandardSetController Class
Visualforce Limits
Q2Salesforce Platform Developer Advanced
Q2. A company has enabled the Translation Workbench and is translating picklist values.
The Account object has a multi-select picklist field, Product__c, that sales representatives use to record which of the company’s products a customer has already implemented.
A developer needs to create an Apex method that retrieves Account records including this Product__c.
To retrieve the values of Product__c in the running user’s language, what should the developer do?
Show answer
Correct answer: A. Use toLabel(Product__c) in the field list of the SOQL query.
This question asks how to retrieve picklist values in the running user’s language in an environment where the Translation Workbench is enabled.In SOQL, using the toLabel() function lets you retrieve the display label of a picklist or reference field according to the user’s language.
In other words, toLabel() is the mechanism that returns the translated label rather than the API value.
This enables appropriate display even in a multilingual environment.
There is no mechanism to convert values after retrieval as in options B and C, and there is no Locale clause in SOQL as in option D.
Therefore, using toLabel(), which converts at SOQL execution time, is the correct answer.
toLabel()
Q3Salesforce Platform Developer Advanced
Q3. A company’s Salesforce administrator created a custom object called Region__c to manage, for each U.S. ZIP code, the company’s sales region to which that ZIP code belongs.
The company needs to implement a trigger on Lead that automatically sets the Region based on the lead’s ZIP code.
Which code segment satisfies this requirement most efficiently?
Object Name: Region__c
Fields:
zip_code__c (Text)
Region_Name__c (Text)
Show answer
Correct answer: D. Option D
In this question, the key point is whether the trigger processing is bulkified. The most efficient is Option D.First, it collects the ZIP codes from Trigger.new into a Set, then retrieves all matching Region__c records in a single SOQL query, and finally uses a Map to look up the Region from each Lead’s PostalCode.
This results in an implementation resilient to governor limits because SOQL is not executed inside a loop.
Option B does reduce the number of queries, but it uses a nested loop, so it becomes inefficient as the record count increases.
Option C is a typical “SOQL inside a loop” and is inappropriate.
Therefore, Option D, which loads the result of a single retrieval into a Map and assigns it to each Lead, is the most efficient.
Bulk Triggers
Trigger and Bulk Request Best Practices
Q4Salesforce Platform Developer Advanced
Q4. Suppose an Apex class called CreateOneAccount implements the Queueable interface and, when executed, creates one Account.
Which test syntax correctly verifies this code? (See the figure below.)
Show answer
Correct answer: B. Option B
Because Queueable Apex is asynchronous processing, the test must use Test.startTest() and Test.stopTest() to force the processing to run.In particular, it is important that the asynchronous processing is actually executed at the point of Test.stopTest().
Therefore, enqueueJob must be called after startTest(), and the results must be verified after stopTest().
Also, the correct procedure is to re-query the results of the asynchronous processing with SOQL after stopTest() and verify them.
Options A and D verify before the asynchronous processing completes, so they are inaccurate, and a technique like Option C is not a common verification method.
Using limits, startTest, and stopTest
Queueable Apex
Q5Salesforce Platform Developer Advanced
Q5. A company’s developer used Custom Settings to store configuration values that change frequently.
However, tests recently began failing in several sandboxes that were refreshed.
To prevent this problem in the future, what action should the developer take?
Show answer
Correct answer: D. Replace the custom setting with custom metadata.
The key point of this question is data consistency across environments and availability during test execution.Because custom settings are treated as data, their contents may change or be lost when a sandbox is refreshed.
Custom metadata, on the other hand, is managed as metadata, so it can be deployed and is always available at test execution time.
In other words, the ability to guarantee identical data across environments is a major advantage of custom metadata.
Also, the fact that it can be referenced without creating data during tests contributes to improved stability.
Therefore, from the perspective of stable operation going forward, migrating to custom metadata is the optimal action.
Apex Developer Guide
Isolating Test Data from Organization Data in Unit Tests
Q6Salesforce Platform Developer Advanced
Q6. A developer created a Lightning Web component that uses lightning-record-edit-form to let users enter lead information.
However, users report that when an input error occurs while saving a lead record, only one error message is displayed at a time.
Which recommended approach validates multiple fields and displays multiple error messages at once with minimal JavaScript?
Show answer
Correct answer: C. Use Validation Rules.
The key point of this question is displaying multiple errors at once with “minimal JavaScript.”In Salesforce, using validation rules lets you implement condition checks on multiple fields declaratively.
In particular, validation rules can define multiple conditions and return multiple error messages at the same time.
Also, lightning-record-edit-form natively supports error display via validation rules, so no additional JavaScript implementation is required.
Options A and B are unnecessarily complex, and Option D is server-side processing, so it is not suited to real-time on-screen display.
Therefore, the best action is validation rules.
Introduction to Aura Components
About This Quick Reference
Q7Salesforce Platform Developer Advanced
Q7. Consider the following conditions.
– There are 200,000 or more Account records.
– These records include some that have been soft-deleted (in the Recycle Bin).
– Account has two fields configured as External IDs (Customer_Number__c and ERR_Key__c).
Select the two queries that are optimized for large data volumes.
Show answer
Correct answer: B, D
When dealing with large data volumes, “selectivity” and the use of indexes are important.Fields configured as External IDs are automatically indexed, so a query that includes one as a condition is faster.
Therefore, Option B, which includes Customer_Number__c (an External ID) as a condition, uses the index and is optimal.
Option D also narrows the target with IsDeleted = false, improving efficiency by excluding unnecessary deleted data.
Option A cannot use an index and is inefficient, and Option C depends on the size of the list, so selectivity is not guaranteed.
Thus, from the perspective of index usage and data narrowing, Options B and D are appropriate.
Apex Developer Guide
Working with Very Large SOQL Queries
Q8Salesforce Platform Developer Advanced
Q8. A developer encountered an error stating “Maximum Trigger Depth Exceeded.”
Which of the following is a possible cause of this error?
Show answer
Correct answer: A. A trigger is being called recursively 16 or more times.
This error occurs when the recursive invocation of a trigger exceeds the limit.To prevent infinite loops, Salesforce sets an upper limit on the number of trigger nestings (recursions), which is a maximum of 16.
Therefore, when the same trigger or a related trigger repeatedly invokes update processing, this limit is reached.
Typically, the cause is a circular structure in which an after update updates another object, which in turn re-invokes the update of the original object.
Therefore, it is important to control trigger re-execution by implementing a recursion-prevention flag or by revisiting the design.
Options B and C are different governor limit errors and are not direct causes of this error.
Triggers and Order of Execution
Triggers
Q9Salesforce Platform Developer Advanced
Q9. A developer is creating a Lightning Web component that retrieves data from Salesforce and assigns that data to a record property.
What must be implemented for this component to retrieve data from Salesforce?
import { LightningElement, api, wire } from 'lwc';
import { getRecord } from 'lightning/uiRecordApi';
export default class Record extends LightningElement {
@api fields;
@api recordId;
record;
}
import { getRecord } from 'lightning/uiRecordApi';
export default class Record extends LightningElement {
@api fields;
@api recordId;
record;
}
Show answer
Correct answer: A. Option A
In Lightning Web components, the wire service is used for data retrieval.When using getRecord, you must specify both the recordId and the fields to retrieve.
Therefore, it is essential to specify the fields as well, as in @wire(getRecord, { recordId: ‘$recordId’, fields: ‘$fields’ }).
This retrieves the required field data of the specified record.
Also, it is important that @wire works reactively and automatically re-retrieves when recordId or fields change.
Option B has incorrect syntax, and Option C is incomplete because it does not specify fields.
Understand the Wire Service
getRecord
Q10Salesforce Platform Developer Advanced
Q10. A company’s Apex trigger creates an Order__c record every time a sales representative updates an Opportunity to Closed Won.
Recently, an issue has occurred where this trigger creates two orders for a single opportunity.
Which is the best technique two developers should use to troubleshoot this problem?
Show answer
Correct answer: D. Add System.debug() to the code and trace the processing using the Developer Console logs.
This question is a case where you need to investigate the possibility that the trigger is running multiple times or interfering with other automation (flows or workflows).For that, a detailed trace using logs is the most effective.
In particular, it is important to use System.debug() to visualize the execution order and count of the processing.
Also, by checking the Developer Console logs, you can identify trigger re-execution and the influence of other automation.
Option A can be an effective way to isolate the issue in some cases, but it is inefficient; Option B is not directly related to solving this problem; and Option C has too broad a scope, making it difficult to identify the cause.
Therefore, the best action is Option D.
Debugging Apex
Apex Developer Guide
