2 packs: 15% off with code BUY2. 3 or more: 20% off with code BUY3.

Free Salesforce Platform Developer II Practice Questions

106 free Salesforce Platform Developer II practice questions from the CertStash pack of 424, each with the correct answer and a full explanation. The rule is the same for every exam: ten free on the product page, 106 free here, all 424 in the pack, and each step includes the one before it.

Question 1

A Visualforce page loads slowly due to the large amount of data it displays. Which strategy can a developer use to improve the performance?

  1. Use Javascript to move data processing to the browser instead of the controller.
  2. Use the transient keywords for the List variables used in the custom controller.
  3. Use lazy loading to load the data on demand, instead of the controller's constructor.
  4. Use an <apex:actionPoller> in the page to load all of the data asynchronously.
Show answer and explanation

Correct answer: C. Use lazy loading to load the data on demand, instead of the controller's constructor.

Lazy loading defers data retrieval until it is actually needed, reducing the initial page load time and the amount of data that must be processed upfront. This is the optimal strategy for pages displaying large datasets. Option A offloads processing but doesn't reduce data transfer. Option B marks variables as transient to exclude them from viewstate, but doesn't solve loading large amounts of data initially. Option D uses actionPoller to load data asynchronously but still loads all data eventually, not on-demand.

Why the other options are wrong

  • A. Moving processing to the browser still requires all data to be transferred initially, not reducing the load time problem.
  • B. Transient keywords prevent viewstate bloat but don't address the core issue of loading all data upfront.
  • D. ActionPoller loads data asynchronously but still retrieves the entire dataset rather than loading on demand.

Question 2

Universal Containers wants to use a Customer Community with Customer Community Plus licenses so their customers can track how many containers they are renting and when they are due back. Many of their customers are global companies with complex Account hierarchies, representing various departments within the same organization. One of the requirements is that certain community users within the same Account hierarchy be able to see several departments' containers, based on a junction object that relates the Contact to the various Account records that represent the departments. Which solution solves these requirements?

  1. A Visualforce page that uses a Custom Controller that specifies without sharing to expose the records
  2. A Custom List View on the junction object with filters that will show the proper records based on owner
  3. A Custom Report Type and a report Lightning Component on the Community Home Page
  4. An Apex Trigger that creates Apex Managed Sharing records based on the junction object's relationships
Show answer and explanation

Correct answer: D. An Apex Trigger that creates Apex Managed Sharing records based on the junction object's relationships

Apex Managed Sharing creates dynamic sharing records based on the relationships defined in the junction object, allowing certain community users to access multiple department Account records based on their Contact relationships. This provides fine-grained, relationship-based access control that adapts to the complex Account hierarchy. Option A using without sharing would expose too much data. Option B is limited to owner-based filtering. Option C reports don't enforce sharing rules for record access.

Why the other options are wrong

  • A. Without sharing bypasses sharing rules entirely, exposing data to users who shouldn't have access rather than controlling access properly.
  • B. List view filters based on owner don't accommodate junction object relationships or cross-department access scenarios.
  • C. Reports and components don't enforce data access restrictions; they simply display data that users already have permission to see.

Question 3

Universal Containers wants to use an external Web Service provided by a third-party vendor to validate that shipping and billing addresses are correct. The current vendor uses basic password authentication, but Universal Containers might switch to a different vendor who uses OAuth. What would allow Universal Containers to switch vendors without updating the code to handle authentication?

  1. Custom Metadata
  2. Custom Setting (List)
  3. Dynamic Endpoint
  4. Named Credential
Show answer and explanation

Correct answer: D. Named Credential

Named Credentials encapsulate authentication details and endpoints, allowing the underlying authentication method to be changed without modifying Apex code. The code calls the named credential, not the authentication directly, making it vendor-agnostic. Option A stores configuration but not authentication methods. Option B stores settings but requires code changes to swap authentication types. Option C is not a real Salesforce feature for this purpose.

Why the other options are wrong

  • A. Custom Metadata stores reference data but doesn't provide a mechanism to abstract authentication away from code.
  • B. Custom Settings would require code changes to handle different authentication types when switching vendors.
  • C. Dynamic Endpoint is not a standard Salesforce feature for managing authentication abstraction.

Question 4

A company has a Lightning Page with many Lightning Components, some that cache reference data. It is reported that the page does not always show the most current reference data. What can a developer use to analyze and diagnose the problem in the Lightning Page?

  1. Salesforce Lightning Inspector Actions Tab
  2. Salesforce Lightning Inspector Event Log Tab
  3. Salesforce Lightning Inspector Transactions Tab
  4. Salesforce Lightning Inspector Storage Tab
Show answer and explanation

Correct answer: D. Salesforce Lightning Inspector Storage Tab

The Storage Tab in Lightning Inspector displays the contents of browser storage (localStorage, sessionStorage) where cached data is typically stored. This allows developers to inspect what data components have cached and verify whether the most current reference data is being persisted and retrieved. Option A is for actions, Option B for events, and Option C for transactions, none of which directly show cached data contents.

Why the other options are wrong

  • A. The Actions Tab shows triggered actions and their details, not cached data storage.
  • B. The Event Log Tab displays component events and messaging, not cached data contents.
  • C. The Transactions Tab shows performance transactions, not where cached data is stored.

Question 5

A Visualforce page contains an industry select list and displays a table of Accounts that have a matching value in their Industry field. <apex:selectList value="{!selectedIndustry}"> <apex:selectOptions values="{!industries}"/> </apex:selectList> When a user changes the value in the industry select list, the table of Accounts should be automatically updated to show the Accounts associated with the selected industry. What is the optimal way to implement this?

  1. Add an <apex:actionFunction> within the <apex:selectOptions>.
  2. Add an <apex:actionFunction> within the <apex:selectList>.
  3. Add an <apex:actionSupport> within the <apex:selectList>.
  4. Add an <apex:actionSupport> within the <apex:selectOptions>.
Show answer and explanation

Correct answer: C. Add an <apex:actionSupport> within the <apex:selectList>.

ActionSupport is placed within the selectList component to listen for events (like onchange) and trigger a controller action to update the table. This is the standard Visualforce pattern for responding to user interactions and rerendering dependent components. Option A and D place actionFunction/actionSupport in the wrong components (selectOptions is not an interactive element). Option B suggests actionFunction, which must be explicitly called and isn't automatically triggered by the selectList change event.

Why the other options are wrong

  • A. ActionFunction within selectOptions doesn't listen to selectList changes and would not auto-update the table.
  • B. ActionFunction requires explicit JavaScript invocation and doesn't automatically respond to selectList changes.
  • D. SelectOptions is a data container, not an interactive component; actionSupport there would not respond to user input.

Question 6

A developer created and tested a Visualforce page in their developer sandbox, but now receives reports that users are encountering ViewState errors when using it in Production. What should the developer ensure to correct these errors?

  1. Ensure queries do not exceed governor limits.
  2. Ensure properties are marked as Transient.
  3. Ensure properties are marked as private.
  4. Ensure profiles have access to the Visualforce page.
Show answer and explanation

Correct answer: B. Ensure properties are marked as Transient.

ViewState errors typically occur when the viewstate size exceeds limits, which happens more frequently in production with larger datasets and more users. Marking properties as transient excludes them from viewstate serialization, directly reducing viewstate size. Option A addresses governor limits but not viewstate. Option C makes properties private but doesn't remove them from viewstate. Option D is about feature access, not viewstate.

Why the other options are wrong

  • A. Governor limit errors are different from viewstate errors; this doesn't address viewstate bloat.
  • C. Private properties are still included in viewstate; transient exclusion is what matters.
  • D. Profile access controls whether users can see the page, not the viewstate size issue.

Question 7

<lightning:layout multipleRows="true"> <lightning:layoutItem size="12">{!v.account.Name} </lightning:layoutItem> <lightning:layoutItem size="12">{!v.account.AccountNumber} </lightning:layoutItem> <lightning:layoutItem size="12">{!v.account.Industry} </lightning:layoutItem> </lightning:layout> Refer to the component code above. The information displays as expected (in three rows) on a mobile device. However, the information is not displaying as desired (in a single row) on a desktop or tablet. Which option has the correct component changes to display correctly on desktops and tablets?

  1. <lightning:layout multipleRows="true"> <lightning:layoutItem size="12" mediumDeviceSize="6" largeDeviceSize="4">{!v.account.Name} </lightning:layoutItem> <lightning:layoutItem size="12" mediumDeviceSize="6" largeDeviceSize="4">{!v.account.AccountNumber} </lightning:layoutItem> <lightning:layoutItem size="12" mediumDeviceSize="6" largeDeviceSize="4">{!v.account.Industry} </lightning:layoutItem> </lightning:layout>
  2. <lightning:layout multipleRows="true"> <lightning:layoutItem size="12" largeDeviceSize="4">{!v.account.Name} </lightning:layoutItem> <lightning:layoutItem size="12" largeDeviceSize="4">{!v.account.AccountNumber} </lightning:layoutItem> <lightning:layoutItem size="12" largeDeviceSize="4">{!v.account.Industry} </lightning:layoutItem> </lightning:layout>
  3. <lightning:layout multipleRows="true"> <lightning:layoutItem size="12" mediumDeviceSize="4">{!v.account.Name} </lightning:layoutItem> <lightning:layoutItem size="12" mediumDeviceSize="4">{!v.account.AccountNumber} </lightning:layoutItem> <lightning:layoutItem size="12" mediumDeviceSize="4">{!v.account.Industry} </lightning:layoutItem> </lightning:layout>
  4. <lightning:layout multipleRows="true"> <lightning:layoutItem size="12" mediumDeviceSize="6">{!v.account.Name} </lightning:layoutItem> <lightning:layoutItem size="12" mediumDeviceSize="6">{!v.account.AccountNumber} </lightning:layoutItem> <lightning:layoutItem size="12" mediumDeviceSize="6">{!v.account.Industry} </lightning:layoutItem> </lightning:layout>
Show answer and explanation

Correct answer: C. <lightning:layout multipleRows="true"> <lightning:layoutItem size="12" mediumDeviceSize="4">{!v.account.Name} </lightning:layoutItem> <lightning:layoutItem size="12" mediumDeviceSize="4">{!v.account.AccountNumber} </lightning:layoutItem> <lightning:layoutItem size="12" mediumDeviceSize="4">{!v.account.Industry} </lightning:layoutItem> </lightning:layout>

To display three items in a single row on desktop/tablet while maintaining three rows on mobile, each item needs mediumDeviceSize="4" (12÷3=4 columns per item for tablets and desktops). The size="12" keeps each item full-width on mobile devices. Option A adds largeDeviceSize which is unnecessary for the requirement. Option B only targets largeDeviceSize, not medium devices (tablets). Option D uses mediumDeviceSize="6", which would display only two items per row.

Why the other options are wrong

  • A. While largeDeviceSize="4" works for desktops, the mediumDeviceSize="6" creates two-column layout on tablets, not one row.
  • B. Omitting mediumDeviceSize means tablets still use size="12", displaying items in rows instead of one row.
  • D. MediumDeviceSize="6" creates a two-column layout on tablets/desktops, not the desired single row of three items.

Question 8

A company's support process dictates that any time a Case is closed with a Status of 'Could not fix', an Engineering Review custom object record should be created and populated with information from the Case, the Contact, and any of the Products associated with the Case. What is the correct way to automate this using an Apex trigger?

  1. An after update trigger that creates the Engineering Review record and inserts it
  2. A before update trigger that creates the Engineering Review record and inserts it
  3. An after upsert trigger that creates the Engineering Review record and inserts it
  4. A before upsert trigger that creates the Engineering Review record and inserts it
Show answer and explanation

Correct answer: A. An after update trigger that creates the Engineering Review record and inserts it

An after update trigger is correct because the Case record must be fully committed to the database before creating dependent records. The trigger executes after the Case is updated and closed, then creates and inserts the Engineering Review record with the final Case values. After triggers are appropriate for creating related records based on changes. Before triggers cannot insert records, and upsert events are not the right context for this case-closing workflow.

Why the other options are wrong

  • B. Before update triggers cannot insert new records; DML statements are not allowed in before triggers.
  • C. Upsert is not the correct trigger event; this is specifically an update scenario when Status changes to 'Could not fix'.
  • D. Before upsert cannot insert records and is still the wrong trigger timing for this update-based workflow.

Question 9

A company wants to build a custom Lightning Component that will display a specified Account Field Set and that can only be added to the Account record page. Which design resource configuration should be used?

  1. <design:component label="Account FS Component"> <design:attribute name="fieldSetName" Label="Field Set Name" /> <sfdc:objects> <sfdc:object>FieldSet</sfdc:object> </sfdc:objects> </design:component>
  2. <design:component label="Account FS Component"> <design:attribute name="fieldSetName" label="Field Set Name" /> <sfdc:objects> <sfdc:object>Account</sfdc:object> </sfdc:objects> </design:component>
  3. <design:component label="Account FS Component"> <aura:attribute name="fieldSetName" label="Field Set Name" /> <sfdc:objects> <sfdc:object>FieldSet</sfdc:object> </sfdc:objects> </design:component>
  4. <design:component label="Account FS Component"> <aura:attribute name="fieldSetName" label="Field Set Name" /> <sfdc:objects> <sfdc:object>Account</sfdc:object> </sfdc:objects> </design:component>
Show answer and explanation

Correct answer: B. <design:component label="Account FS Component"> <design:attribute name="fieldSetName" label="Field Set Name" /> <sfdc:objects> <sfdc:object>Account</sfdc:object> </sfdc:objects> </design:component>

Design resource configuration uses the <design:attribute> tag (not <aura:attribute>) to define configurable properties for Lightning Components. The <sfdc:objects> element specifies which Salesforce objects the component can be added to. Since the component displays Account Field Sets and should only be added to Account record pages, the object must be Account, not FieldSet. FieldSet is not a valid Salesforce object for the <sfdc:object> tag.

Why the other options are wrong

  • A. Uses FieldSet as the object, which is incorrect, components are restricted by the object they display data for, not by field set.
  • C. Uses <aura:attribute> instead of <design:attribute>, which is the wrong element for design-time configuration properties.
  • D. Uses <aura:attribute> instead of <design:attribute>, which does not expose the property for configuration in the App Builder.

Question 10

A developer created a new trigger that inserts a Task when a new Lead is created. After deploying to production, an outside integration is periodically reporting errors. Which change should the developer make to ensure the integration is not affected with minimal impact to business logic?

  1. Remove the Apex Class from the Integration User's Profile.
  2. Use the Database method with allOrNone set to False.
  3. Use a Try/Catch block after the insert statement.
  4. Deactivate the Trigger before the Integration runs.
Show answer and explanation

Correct answer: B. Use the Database method with allOrNone set to False.

When a trigger performs DML operations that fail, the entire transaction rolls back by default, which can break external integrations. Using Database.insert() with allOrNone set to False allows partial success, successful records are committed even if some fail, preventing the entire integration from failing. This is the minimal-impact solution that preserves business logic while ensuring the integration continues functioning.

Why the other options are wrong

  • A. Removing the class from the Integration User's Profile would prevent the trigger from running for that user, but this breaks the intended business logic for all users.
  • C. A Try/Catch block alone does not prevent rollback; it only handles exceptions but doesn't allow partial commits.
  • D. Deactivating the trigger before the integration runs disables the business logic entirely, which is not minimal impact.

What people say about the full Platform Developer II pack 5.0 from 1

I struggled initially with data integration, but the study resources helped clarify concepts. With steady effort, I passed PDII. I appreciate the support from Cert Stash on tricky parts.
Jude LambertPlatform Developer II

Question 11

What is the transaction limit on the recursive trigger depth?

  1. 10
  2. 17
  3. 16
  4. 3
  5. There is no limit
Show answer and explanation

Correct answer: C. 16

Salesforce enforces a recursive trigger depth limit of 16, meaning a trigger can be called recursively up to 16 times before the system prevents further recursion to avoid infinite loops and system resource exhaustion.

Why the other options are wrong

  • A. 10 is too low and not the actual Salesforce limit.
  • B. 17 exceeds the actual recursive trigger depth limit.
  • D. 3 is significantly lower than the actual limit.
  • E. Salesforce enforces a specific limit to prevent runaway recursion.

Question 12

A developer has created a Visualforce page that uses a third-party JavaScript framework. The developer has decided to supply data to the JavaScript functions using JavaScript Remoting for Apex Controllers. What is the correct syntax to declare a remote method in Apex? (Choose two.)

  1. @RemoteAction global static String getTable()
  2. @RemoteAction global String getTable()
  3. @RemoteAction public static String getTable()
  4. @RemoteObject global static String getTable()
Show answer and explanation

Correct answer: A, C. @RemoteAction global static String getTable(); @RemoteAction public static String getTable()

The correct syntax for declaring a remote method in Apex requires the @RemoteAction annotation, global access modifier, and static keyword. Option A correctly shows all three requirements: @RemoteAction global static String getTable(). Option C is also correct as public static can be used instead of global static, though global is more common. Option B is incorrect because it omits the static keyword, which is required for remote methods. Option D uses @RemoteObject instead of @RemoteAction, which is the wrong annotation.

Why the other options are wrong

  • B. The static keyword is required for remote methods; this declaration is missing it.
  • D. @RemoteObject is not the correct annotation; @RemoteAction must be used for JavaScript remoting.

Question 13

A company wants to incorporate a third-party web service to set the Address fields when an Account is inserted, if they have not already been set. What is the optimal way to achieve this?

  1. Create a Process, call an Apex @future(callout=true) method from it, and make the callout from that Apex method.
  2. Create a Process, call an Apex @InvocableMethod from it, and make the callout from that Apex method.
  3. Create an after insert trigger, call an Apex @InvocableMethod method from it, and make the callout from that Apex method.
  4. Create an after insert trigger, call an @future(callout=true) method from it, and make the callout from that Apex method.
Show answer and explanation

Correct answer: D. Create an after insert trigger, call an @future(callout=true) method from it, and make the callout from that Apex method.

Creating an after insert trigger and calling an @future(callout=true) method is the optimal approach. The @future annotation with callout=true is specifically designed to handle web service callouts asynchronously from triggers, which is necessary because triggers cannot make synchronous callouts. This pattern reliably handles the callout without blocking the trigger transaction.

Why the other options are wrong

  • A. While Processes can call @future methods, using a Process adds an unnecessary layer of complexity for this straightforward trigger use case.
  • B. @InvocableMethod is designed for being called from Flows and Processes, not for making callouts from triggers, and doesn't solve the callout-from-trigger constraint.
  • C. Calling @InvocableMethod from an after insert trigger doesn't address the restriction that triggers cannot make synchronous callouts.

Question 14

A company has many different unit test methods that create Account records as part of their data setup. A new required field was added to the Account and now all of the unit tests fail. What is the optimal way for a developer to fix the issue?

  1. Add a before insert trigger on Account to set the value of the required field.
  2. Create a TestDataFactory class that serves as the single place to create Accounts for unit tests and set the required field there.
  3. Change the required field to be a validation rule that excludes the System Administrator profile.
  4. Add the required field to the data setup for all of the unit tests.
Show answer and explanation

Correct answer: B. Create a TestDataFactory class that serves as the single place to create Accounts for unit tests and set the required field there.

A TestDataFactory class is the optimal solution because it centralizes test data creation in a single, reusable location. When a required field is added, the developer updates the factory once, and all tests automatically use the correct data setup. This follows the DRY principle and makes maintenance easier than updating every individual test.

Why the other options are wrong

  • A. A before-insert trigger would set the field for production data as well, which may not be the intended behavior and masks the real issue.
  • C. A validation rule that excludes System Administrator is a workaround that doesn't address the root cause and complicates the data model.
  • D. Adding the field to every test manually is repetitive, error-prone, and violates the DRY principle, making maintenance harder when the field requirements change.

Question 15

What is a potential design issue with the following code? trigger accountTrigger on Account (before update){ Boolean processOpportunity = false; List<opportunity> opptysClosedLost = new List<opportunity>() List<opportunity> IstAllOpp = [select StageName from Opportunity where accountId IN :Trigger.newMap.keySet()]; if(!IstAllOpp.isEmpty()) processOpportunity = true; while(processOpportunity) { for(opportunity o : IstAllOpp) if(o.StageName == 'Closed - Lost') opptysClosedLost.add(o); processOpportunity = false; if(!opptysClosedLost.isEmpty()) delete opptysClosedLost;

  1. SOQL could be avoided by creating a formula field for StageName in Account from the related Opportunity
  2. The code will result in a System.LimitException : Too many script statements error
  3. The code will result in a System.DmlException:Entity_is_Deleted error
  4. The code will result in a System.LimitException: Apex CPU time limit exceeded error
Show answer and explanation

Correct answer: B. The code will result in a System.LimitException : Too many script statements error

The code contains an unnecessary while loop that sets processOpportunity to true initially, then false after the first iteration. However, the while loop structure combined with the list processing creates excessive script statements. The loop iterates through all opportunities, checking each one's stage name, then deletes matching records. This pattern of querying, looping through potentially large result sets, and performing DML operations in a before trigger context can cause a Too many script statements error, which counts iterations and operations toward the governor limit.

Why the other options are wrong

  • A. While a formula field could optimize the query design, this does not address the immediate cause of the error.
  • C. The delete operation occurs within the trigger, not in a context where deleted records would cause this specific error.
  • D. CPU time limits are typically exceeded by complex calculations or inefficient algorithms; this code's issue manifests as statement execution limits first.

Question 16

The "action" attribute on <apex:page> is ONLY evaluated on which type of request?

  1. Get request
  2. Postback request
Show answer and explanation

Correct answer: A. Get request

The 'action' attribute on the <apex:page> tag is evaluated only on initial GET requests when the page first loads, not on postback requests. Postback requests occur when users interact with form elements, and they execute different actions tied to specific button or link clicks rather than the page-level action attribute.

Why the other options are wrong

  • B. The page-level action attribute is not evaluated during postback requests; instead, actions associated with specific form components (buttons, links) are executed based on user interaction.

Question 17

Which statement should be used to allow some of the records in a list of records to be inserted if others fail to be inserted?

  1. insert (records, false)
  2. Database.insert(records, false)
  3. Database.insert(records, true)
  4. insert records
Show answer and explanation

Correct answer: B. Database.insert(records, false)

Database.insert(records, false) is the correct syntax to allow partial success when inserting a list of records. The second parameter of false indicates that the operation should not throw an exception if some records fail; instead, it returns a SaveResult object for each record showing success or failure individually. This enables processing to continue even when some records cannot be inserted.

Why the other options are wrong

  • A. The insert statement does not accept parameters in this syntax; this is invalid Apex code.
  • C. Database.insert(records, true) sets the second parameter to true, which throws an exception on the first failure and prevents partial success.
  • D. insert records with no parameters uses the default behavior of throwing an exception on failure, preventing partial success.

Question 18

The REST API __________.

  1. Is based on REST principles and is optimized for loading or deleting large sets of data. You can use it to query, queryAll, insert, update, upsert, or delete many records asynchronously by submitting batches
  2. Provides a powerful, convenient, and simple REST-based web services interface for interacting with Salesforce. Its advantages include ease of integration and development, and it's an excellent choice of technology for use with mobile applications and web projects
  3. Is used to create, retrieve, update or delete records, such as accounts, leads, and custom objects, and allows you to maintain passwords, perform searches, and much more
  4. Is used to retrieve, deploy, create, update, or delete customizations for your org. The most common use is to migrate changes from a sandbox or testing org to your production environment
Show answer and explanation

Correct answer: B. Provides a powerful, convenient, and simple REST-based web services interface for interacting with Salesforce. Its advantages include ease of integration and development, and it's an excellent choice of technology for use with mobile applications and web projects

The REST API provides a simple, REST-based web services interface optimized for ease of integration and development, making it the ideal choice for mobile applications and web projects.

Why the other options are wrong

  • A. This describes the Bulk API, which handles asynchronous batch operations.
  • C. This describes the SOAP API, which handles record creation and manipulation.
  • D. This describes the Metadata API, which handles customization deployments.

Question 19

Which type of controller is best suited when you want all of the basic DML functions from an object's normal new/edit page?

  1. Standard Controller
  2. Standard List/Set Controller
  3. Controller Extensions
  4. Custom Controller
Show answer and explanation

Correct answer: A. Standard Controller

A Standard Controller provides all basic DML functions (insert, update, delete, view) for a single object's standard new/edit page without requiring custom code. This is the optimal choice when standard functionality suffices.

Why the other options are wrong

  • B. A Standard List/Set Controller is designed for handling multiple records, not the single object new/edit scenario.
  • C. Controller Extensions add custom functionality to existing controllers but do not provide basic DML by themselves.
  • D. Custom Controllers require manual implementation of all DML logic and are unnecessary when standard functionality is available.

Question 20

How long is field history retained?

  1. 18 Months
  2. 12 Months
  3. 24 Months
  4. 6 Months
  5. 36 Months
Show answer and explanation

Correct answer: A. 18 Months

Field history tracking in Salesforce retains data for 18 months. After this period, the oldest field history records are automatically deleted. This retention period applies to all field history tracked through the audit trail feature.

Why the other options are wrong

  • B. 12 months is shorter than the actual retention period.
  • C. 24 months exceeds the actual field history retention limit.
  • D. 6 months is significantly shorter than the actual retention period.
  • E. 36 months exceeds the actual field history retention limit.

Question 21

Which of the following about Dynamic Apex is incorrect?

  1. You can retrieve the sObject type from an Id by calling .getSObjectType()
  2. getDescribe() can get you a variety of info on a particular object/field
  3. Schema.getGlobalDescribe() gives you a map of all sObject
  4. In dynamic SOQL, you can use bind variables and bind variable fields
Show answer and explanation

Correct answer: D. In dynamic SOQL, you can use bind variables and bind variable fields

In dynamic SOQL, you cannot use bind variables with field names directly. While bind variables work for values in WHERE clauses, field names and object types must be specified as strings in dynamic queries. Options A, B, and C correctly describe valid Dynamic Apex capabilities.

Why the other options are wrong

  • A. getSObjectType() correctly retrieves the sObject type from an Id.
  • B. getDescribe() accurately provides detailed information about objects and fields.
  • C. Schema.getGlobalDescribe() correctly returns a map of all available sObjects.

Question 22

Which of the following exceptions cannot be caught and will force an error? (Choose three.)

  1. LimitException
  2. AssertException
  3. SObjectExceptions
  4. DMLException
  5. License exceptions
  6. ListException
Show answer and explanation

Correct answer: A, B, E. LimitException; AssertException; License exceptions

LimitException, AssertException, and License exceptions cannot be caught in Apex and will force an error to stop execution. These represent system-level failures that bypass normal exception handling. DMLException, SObjectException, and ListException are standard exceptions that can be caught.

Why the other options are wrong

  • C. SObjectException can be caught using standard try-catch blocks.
  • D. DMLException can be caught to handle database operation failures.
  • F. ListException can be caught when list operations fail.

Question 23

What is the transaction limit for the number of records using QueryLocator?

  1. 50,000
  2. 50,000,000
  3. 100,000
  4. 5,000,000
  5. There is no limit
Show answer and explanation

Correct answer: B. 50,000,000

A QueryLocator is used in batch Apex to retrieve records and can handle up to 50 million records. This higher limit is one of the key advantages of using QueryLocator over a standard SOQL query, as it allows batch jobs to process much larger datasets while maintaining governor limit compliance.

Why the other options are wrong

  • A. 50,000 is the limit for standard SOQL queries, not QueryLocator.
  • C. 100,000 is significantly below the 50 million record limit for QueryLocator.
  • D. 5,000,000 is below the actual limit of 50 million records.
  • E. QueryLocator has an upper limit of 50 million records.

Question 24

Which use case is an appropriate fit for the @future asynchronous Apex method? (Choose two.)

  1. A developer has jobs that need larger query results than regular transactions allow
  2. A developer needs to segregate DML operations and bypass the mixed save DML error
  3. A developer has long-running jobs with large data volumes that need to be performed in batches
  4. A developer has long-running methods and needs to prevent delaying an Apex transaction
Show answer and explanation

Correct answer: B, D. A developer needs to segregate DML operations and bypass the mixed save DML error; A developer has long-running methods and needs to prevent delaying an Apex transaction

@future methods execute asynchronously and allow you to bypass the mixed DML error by segregating DML operations on different object types into separate transactions. They also prevent long-running methods from delaying the current Apex transaction, returning control immediately to the caller while the future method executes in a separate context. These are ideal use cases for the @future annotation.

Why the other options are wrong

  • A. @future methods do not provide higher query limits; Batch Apex is the appropriate choice for jobs requiring larger query results than standard transaction limits allow.
  • C. Batch Apex (using Database.Batchable) is the recommended approach for long-running jobs with large data volumes that need to be performed in batches, not @future methods.

Question 25

A developer needs to send Account records to an external system for backup purposes. The process must take a snapshot of Accounts as they are saved and then make a callout to a RESTful web service. The web service can only receive, at most, one record per call. Which feature should be used to implement these requirements?

  1. @future
  2. Queueable
  3. Process Builder
  4. Workflow
Show answer and explanation

Correct answer: B. Queueable

Queueable is the optimal feature because it allows asynchronous execution of code that makes callouts to external web services. Queueable can handle one Account record per call as required, and it properly manages callouts outside the synchronous transaction context where callouts are prohibited. Queueable also supports chaining for processing multiple records sequentially. Process Builder cannot make direct REST callouts. @future is outdated and less flexible than Queueable for callout scenarios.

Why the other options are wrong

  • A. @future methods cannot make callouts to external services; they can only perform DML or SOQL.
  • C. Process Builder cannot make callouts to RESTful web services.
  • D. Workflows cannot make callouts to external systems.

25 questions in. Want the rest? The first half of the pack, free by email · The full pack

Question 26

A customer requires that when the billing address field on an Account gets updated, the address field on all its related contact records should reflect the same update. How can this requirement be met with minimal customizations?

  1. Create an After Trigger on Account to update its related contact records on update
  2. Create a Workflow Rule on Account to update related child Contact records
  3. Create a Lightning Process on Account to update related child Contact records
  4. Create a scheduled batch job that updates all contact address fields based on the related account record
Show answer and explanation

Correct answer: C. Create a Lightning Process on Account to update related child Contact records

A Lightning Process (Flows) on Account with the update trigger is the minimal customization approach for this requirement. Processes can directly update related child records through relationship traversal without requiring custom code. While triggers would work, they require more code maintenance. Workflow Rules are deprecated in favor of Flows, and scheduled batch jobs are unnecessarily complex for immediate synchronization on updates.

Why the other options are wrong

  • A. Although triggers can accomplish this, they require more code and maintenance than a declarative Process.
  • B. Workflow Rules are deprecated and have been superseded by Flows/Processes.
  • D. A scheduled batch job is unnecessarily complex and introduces delays when real-time updates are needed on every account update.

Question 27

A developer needs to design a custom object that will be integrated into a back-end system. What should the developer do to ensure good data quality and to ensure that data imports, integrations, and searches perform well? (Choose two.)

  1. Configure a custom field as unique
  2. Configure a custom field as indexed
  3. Configure a custom field as external ID
  4. Configure a custom field as Salesforce ID
Show answer and explanation

Correct answer: A, C. Configure a custom field as unique; Configure a custom field as external ID

To ensure good data quality and support integrations, a custom field should be configured as Unique to prevent duplicate values, and as an External ID to identify and match records during data imports and integrations. The External ID field allows external systems to reference Salesforce records without relying on the Salesforce ID. Together, these configurations ensure data integrity and facilitate seamless system integration. An indexed field improves query performance but does not directly ensure data quality. Salesforce ID is a system-generated field and cannot be configured as custom.

Why the other options are wrong

  • B. While indexing improves query performance, it does not directly address data quality or integration requirements.
  • D. Salesforce ID is an auto-generated system field that cannot be configured as a custom field on a custom object.

Question 28

The Metadata API __________.

  1. Is based on REST principles and is optimized for loading or deleting large sets of data. You can use it to query, queryAll, insert, update, upsert, or delete many records asynchronously by submitting batches
  2. Provides a powerful, convenient, and simple REST-based web services interface for interacting with Salesforce. Its advantages include ease of integration and development, and it's an excellent choice of technology for use with mobile applications and web projects
  3. Is used to create, retrieve, update or delete records, such as accounts, leads, and custom objects, and allows you to maintain passwords, perform searches, and much more
  4. Is used to retrieve, deploy, create, update, or delete customizations for your org. The most common use is to migrate changes from a sandbox or testing org to your production environment
Show answer and explanation

Correct answer: D. Is used to retrieve, deploy, create, update, or delete customizations for your org. The most common use is to migrate changes from a sandbox or testing org to your production environment

The Metadata API is used to retrieve, deploy, create, update, or delete customizations for an organization, with its most common use being the migration of changes from sandbox or testing environments to production.

Why the other options are wrong

  • A. This describes the Bulk API, which handles asynchronous batch data operations.
  • B. This describes the REST API, which focuses on integration and development.
  • C. This describes the SOAP API, which handles record-level data manipulation.

Question 29

Within the System.Limit class, what would you call to get the number of calls made in your transaction?

  1. get[typeOfLimit] --> (Ex. getDMLStatements())
  2. getLimit[typeOfLimit] --> (Ex. getLimitDMLStatements())
Show answer and explanation

Correct answer: A. get[typeOfLimit] --> (Ex. getDMLStatements())

Within the System.Limits class, you call get[typeOfLimit]() to retrieve the number of calls made for a specific limit type. For example, getDMLStatements() returns the number of DML statements executed in the current transaction.

Why the other options are wrong

  • B. The method pattern uses get, not getLimit; getLimit methods are used to retrieve the limit threshold, not the current count.

Question 30

A developer has generated Apex code from a WSDL for an external web service. The web service requires Basic authentication. What code should the developer use to authenticate?

  1. Http.setHeader ('Authorization' , 'Basic QthZGprjpchVulHNchFtZQ')
  2. stub.inputHttpHeaders_x.put('Authorization' , 'Basic QthZGprjpchVulHNchFtZQ')
  3. Http.setAuthentication('Basic QthZGprjpchVulHNchFtZQ')
  4. stub.authentication.put ('Authorization','Basic QthZGprjpchVulHNchFtZQ')
Show answer and explanation

Correct answer: B. stub.inputHttpHeaders_x.put('Authorization' , 'Basic QthZGprjpchVulHNchFtZQ')

When using Apex code generated from a WSDL, the generated stub class contains the inputHttpHeaders_x map that is specifically designed to hold HTTP headers including authentication. The correct syntax is to put the Authorization header with the Basic authentication token into this map. This is the standard pattern for WSDL-generated web service clients in Salesforce.

Why the other options are wrong

  • A. Http.setHeader() is a static method on the Http class and does not exist; headers must be set on the HttpRequest object instead.
  • C. Http.setAuthentication() is not a valid method on the Http class.
  • D. stub.authentication is not a valid property on WSDL-generated stub classes; inputHttpHeaders_x is the correct property to use.

Question 31

Choose the correct definition for <apex:messages>.

  1. Standard Salesforce formatting, throws a specific message on a page
  2. Standard Salesforce formatting, shows all errors that occur on page. Can add more messages through the "ApexPages.addMessage" function
  3. A single message, without formatting, that can be associated with a specific component on the page
  4. No formatting; displays all errors on a page
Show answer and explanation

Correct answer: B. Standard Salesforce formatting, shows all errors that occur on page. Can add more messages through the "ApexPages.addMessage" function

The <apex:messages> component displays all errors that occur on a page with standard Salesforce formatting. It can be populated with additional messages using the ApexPages.addMessage() function, allowing you to display both system-generated and custom error messages in a unified manner.

Why the other options are wrong

  • A. That describes <apex:pageMessage>, which shows a single specific message.
  • C. That describes <apex:message>, not <apex:messages>.
  • D. Messages do have standard Salesforce formatting applied.

Question 32

Which of the following annotations is the right way to invoke a single apex method?

  1. @InvokableMethod()
  2. @InvokableAction()
  3. @InvokableApex()
Show answer and explanation

Correct answer: A. @InvokableMethod()

The @InvokableMethod annotation is the correct and standard way to mark an Apex method so it can be invoked from Flow, Process Builder, or other declarative tools. This annotation makes the method available for use in declarative automation.

Why the other options are wrong

  • B. @InvokableAction() is not a valid Apex annotation.
  • C. @InvokableApex() is not a valid Apex annotation for making methods invocable.

Question 33

A developer is asked to update data in an org based on new business rules. The new rules state that Accounts with the type set to 'Customer' should have a status of 'Active', and Accounts with the type set to 'Prospect' should have a status of 'Pending'. No other changes to data should be made. Which code block will accurately meet the business requirements?

  1. Map<String, String> statusMap = new Map<String, String>{'Customer'=>'Active', 'Prospect'=>'Pending'} List<Account> accountUpdates = new List<Account>(); for ( Account a : [SELECT Id, Type FROM Account]){ if ( statusMap.containsKey(a.Type) ) { a.Status = a.Type == 'Customer' ? 'Active' : 'Pending'; } accountUpdates.add(a); } update accountUpdates;
  2. Map<String, String> statusMap = new Map<String, String>{'Customer'=>'Active', 'Prospect'=>'Pending'} List<Account> accountUpdates = new List<Account>(); for ( Account a : [SELECT Id, Type FROM Account WHERE Status IN :statusMap.keySet()]){ a.Status = statusMap.get(a.Type); accountUpdates.add(a); } update accountUpdates;
  3. List<Account> accountUpdates = new List<Account>(); for ( Account a : [SELECT Id, Type FROM Account]){ if ( String.isNotBlank(a.Type) && a.Type == 'Customer' ){ a.Status = 'Active'; } if ( String.isNotBlank(a.Type) && a.Type == 'Prospect' ){ a.Status = 'Pending'; } accountUpdates.add(a); } update accountUpdades;
  4. List<Account> accountUpdates = new List<Account>(); for ( Account a : [SELECT Id, Type FROM Account]){ a.Status = a.Type == 'Customer' ? 'Active' : 'Pending'; accountUpdates.add(a); } update accountUpdates;
Show answer and explanation

Correct answer: A. Map<String, String> statusMap = new Map<String, String>{'Customer'=>'Active', 'Prospect'=>'Pending'} List<Account> accountUpdates = new List<Account>(); for ( Account a : [SELECT Id, Type FROM Account]){ if ( statusMap.containsKey(a.Type) ) { a.Status = a.Type == 'Customer' ? 'Active' : 'Pending'; } accountUpdates.add(a); } update accountUpdates;

Option A only changes Status when the Type is Customer or Prospect, setting Active or Pending accordingly, and leaves every other Account's data unchanged. The code compiles and meets the requirement that no other data changes are made.

Why the other options are wrong

  • B. It filters the query on Status instead of Type, so it selects the wrong records and misses the intended Accounts.
  • C. It updates a misspelled variable, accountUpdades, so the code will not compile.
  • D. It sets every non-Customer Account to Pending, changing data for Accounts that are not Prospects.

Question 34

Which method should be used to convert a Date to a String in the current user's locale?

  1. Date.format
  2. String.format
  3. String.valueOf
  4. Date.parse
Show answer and explanation

Correct answer: A. Date.format

Date.format() is the correct method to convert a Date to a String in the current user's locale. This method respects the user's locale settings for date formatting, ensuring the output matches the user's expected date format.

Why the other options are wrong

  • B. String.format() is used for string interpolation and placeholder substitution, not for date conversion.
  • C. String.valueOf() converts a Date to a String but does not respect the user's locale; it uses a fixed format.
  • D. Date.parse() converts a String to a Date, which is the opposite operation needed.

Question 35

Part of a custom Lightning Component displays the total number of Opportunities in the org, which is in the millions. The Lightning Component uses an Apex Controller to get the data it needs. What is the optimal way for a developer to get the total number of Opportunities for the Lightning Component?

  1. Apex Batch job that counts the number of Opportunity records
  2. SUM() SOQL aggregate query on the Opportunity object
  3. SOQL for loop that counts the number of Opportunities records
  4. COUNT() SOQL aggregate query on the Opportunity object
Show answer and explanation

Correct answer: D. COUNT() SOQL aggregate query on the Opportunity object

The COUNT() aggregate function in a SOQL query is the optimal method to retrieve a record count efficiently. It returns a single integer representing the total number of records without retrieving the records themselves, making it extremely fast and resource-efficient even for millions of records. A Batch job is unnecessary overhead, a SUM() query is inappropriate for counting records, and a for loop iterates through records inefficiently and risks hitting governor limits.

Why the other options are wrong

  • A. Batch jobs are overkill for a simple count operation and introduce unnecessary complexity and latency.
  • B. SUM() aggregates numeric field values, not record counts.
  • C. A for loop iterates through records, consuming heap memory and risking governor limit violations on millions of records.

Question 36

What Salesforce tool lets you deploy/retrieve metadata, check status of apex jobs, and check responses of REST calls?

  1. Force.com Migration Tool
  2. Developer Console
  3. Workbench
  4. Streaming API
Show answer and explanation

Correct answer: C. Workbench

Workbench is a comprehensive browser-based tool that enables developers to deploy and retrieve metadata, monitor the status of Apex jobs, and inspect responses from REST API calls. The Force.com Migration Tool handles metadata deployment but lacks the interactive features; the Developer Console is IDE-focused; and the Streaming API is for data synchronization, not a development tool.

Why the other options are wrong

  • A. The Force.com Migration Tool is command-line based and primarily for metadata deployment, not for checking job status or REST responses interactively.
  • B. The Developer Console is an integrated development environment focused on code editing and debugging, not metadata deployment or REST call inspection.
  • D. The Streaming API is a messaging protocol for push notifications, not a tool for deployment or status monitoring.

Question 37

A developer is trying to decide between creating a Visualforce component or a Lightning component for a custom screen. Which functionality consideration impacts the final decision?

  1. Does the screen need to be rendered as a PDF?
  2. Does the screen need to be accessible from the Lightning Experience UI?
  3. Will the screen make use of a JavaScript framework?
  4. Will the screen be accessed via a mobile app?
Show answer and explanation

Correct answer: A. Does the screen need to be rendered as a PDF?

PDF rendering is a key differentiator between Visualforce and Lightning components. Visualforce has native support for rendering pages as PDFs using the <apex:page> renderAs attribute, making it the optimal choice when PDF generation is required. Lightning components do not have built-in PDF rendering capabilities. The other options are not true differentiators: both can be used in Lightning Experience (B), both can use JavaScript frameworks (C), and both can be accessed via mobile apps through Salesforce mobile (D).

Why the other options are wrong

  • B. Both Visualforce and Lightning components can be used in Lightning Experience, so this is not a differentiating factor.
  • C. Both Visualforce and Lightning components can incorporate JavaScript frameworks, making this not a deciding factor.
  • D. Both can be accessed via Salesforce mobile applications, so mobile access is not a distinguishing consideration.

Question 38

Invokable methods accept sObjects as parameters.

  1. True
  2. False
Show answer and explanation

Correct answer: A. True

Invokable methods can accept sObjects as parameters. They support sObject types, primitive types, lists of these types, and wrapper classes, making them flexible for accepting complex data structures from flows and processes.

Why the other options are wrong

  • B. This statement is false; invokable methods do support sObject parameters.

Question 39

A company has a native iOS app for placing orders that needs to connect to Salesforce to retrieve consolidated information from many different objects in a JSON format. Which is the optimal method to implement this in Salesforce?

  1. Apex REST Web Service
  2. Apex SOAP Web Service
  3. Apex SOAP Callout
  4. Apex REST Callout
Show answer and explanation

Correct answer: A. Apex REST Web Service

An Apex REST Web Service is the optimal method for a native iOS app to retrieve consolidated data from multiple Salesforce objects in JSON format. REST APIs are lightweight, JSON-native, and ideal for mobile client consumption. The service exposes Salesforce data through HTTP endpoints that the iOS app can call directly, making it the standard approach for mobile integration scenarios.

Why the other options are wrong

  • B. SOAP Web Services return XML and are more complex than necessary for mobile applications.
  • C. An Apex SOAP Callout is for Salesforce calling external SOAP services, not for external apps calling Salesforce.
  • D. An Apex REST Callout is for Salesforce calling external REST services, not for external apps calling Salesforce.

Question 40

What is the transaction limit for the number of records per DML statement?

  1. 5,000
  2. 20,000
  3. 50,000
  4. 10,000
  5. There is no limit
Show answer and explanation

Correct answer: D. 10,000

Salesforce enforces a transaction limit of 10,000 records per DML statement. This includes insert, update, upsert, and delete operations within a single transaction. This limit ensures system stability and prevents runaway processes from consuming excessive resources.

Why the other options are wrong

  • A. 5,000 is too low and not the actual Salesforce limit.
  • B. 20,000 exceeds the standard transaction limit for DML operations.
  • C. 50,000 is far beyond the enforced transaction limit.
  • E. There is definitely a limit on DML records per transaction.

Question 41

How would you test a web service?

  1. Use the @future annotation on the method
  2. Call the WebService interface
  3. Web Services do not need to be tested
  4. Create a class that implements the WebServiceMock interface
Show answer and explanation

Correct answer: D. Create a class that implements the WebServiceMock interface

To test web services in Salesforce, you create a test class that implements the WebServiceMock interface. This allows you to mock the external web service responses and test your callout code without making actual external calls.

Why the other options are wrong

  • A. The @future annotation is for asynchronous methods, not for testing web services.
  • B. The WebService interface is not called directly; it is implemented by the service provider.
  • C. Web services absolutely require testing to ensure proper integration and error handling.

Question 42

What is the transaction limit for the number of records for SOQL queries?

  1. 5,000
  2. 20,000
  3. 50,000
  4. 10,000
  5. There is no limit
Show answer and explanation

Correct answer: C. 50,000

Salesforce limits the number of records returned by a single SOQL query to 50,000 rows within a transaction. This is a hard limit enforced to prevent resource exhaustion and ensure system stability. Queries returning more than 50,000 records will fail with a limit exceeded exception.

Why the other options are wrong

  • A. 5,000 is too low; standard SOQL queries can return up to 50,000 records.
  • B. 20,000 is below the actual limit of 50,000 records.
  • D. 10,000 is below the actual limit of 50,000 records.
  • E. There is a strict limit of 50,000 records per SOQL query.

Question 43

A developer needs test data for Apex test classes. What can the developer use to provide test data to the test methods? (Choose two.)

  1. List<sObject> Is = Test.loadData (Lead.sObjectType, 'myTestLeads');
  2. myDataFactory.createTestRecords (10)
  3. Database.createTestRecords (10)
  4. List<sObject> Is = Test.loadDat (Lead.sObjectType, $Resource + 'myTestLeads');
Show answer and explanation

Correct answer: A, B. List<sObject> Is = Test.loadData (Lead.sObjectType, 'myTestLeads');; myDataFactory.createTestRecords (10)

Test.loadData() is the standard Salesforce method for loading test data from static resources into test classes, as shown in option A with correct syntax. A data factory pattern using custom methods like myDataFactory.createTestRecords() is a valid developer pattern for creating test data programmatically, as shown in option B. Database.createTestRecords() does not exist as a valid method. Option D has incorrect syntax with a malformed resource reference using concatenation rather than the proper Resource syntax.

Why the other options are wrong

  • C. Database.createTestRecords() is not a valid Salesforce method for test data creation.
  • D. The syntax for accessing static resources in Test.loadData() is incorrect; it should use Resource notation properly.

Question 44

A company exposes a REST web service and wants to establish two-way SSL between Salesforce and the REST web service. A certificate signed by an appropriate certificate authority has been provided to the developer. What modification is necessary on the Salesforce side? (Choose two.)

  1. Create an entry for the certificate in Certificate and Key Management
  2. Update the code to use HttpRequest.setClientCertificateName()
  3. Configure two-factor authentication with the provided certificate
  4. Update the code to use HttpRequest.setHeader() to set an Authorization header
Show answer and explanation

Correct answer: A, B. Create an entry for the certificate in Certificate and Key Management; Update the code to use HttpRequest.setClientCertificateName()

Establishing two-way SSL requires two steps: First, create an entry for the certificate in Certificate and Key Management so Salesforce can use it as a client certificate. Second, update the HttpRequest code to call setClientCertificateName() with the certificate name, which tells Salesforce which client certificate to use when making the HTTPS request. These two modifications together enable mutual TLS authentication between Salesforce and the external service.

Why the other options are wrong

  • C. Two-factor authentication is unrelated to two-way SSL certificate configuration and would not establish mutual TLS.
  • D. Setting an Authorization header does not implement client certificate authentication; headers are used for other authentication schemes but not for two-way SSL/mutual TLS.

Question 45

During the Visualforce Page execution, what step follows immediately after "Evaluate constructors on controller and extensions"?

  1. Create the view state
  2. Evaluate constructors, extensions, and expression on attribute definitions on any custom components present
  3. Evaluate expressions, <apex:page> attribute actions, and other method calls (getters/setters) on main page
  4. Send HTML to Browser
Show answer and explanation

Correct answer: B. Evaluate constructors, extensions, and expression on attribute definitions on any custom components present

The Visualforce page execution lifecycle follows a specific sequence. After evaluating constructors on the controller and extensions, the next step is to evaluate constructors, extensions, and expressions on attribute definitions for any custom components present on the page. This allows custom components to initialize their own logic before the main page expressions are evaluated.

Why the other options are wrong

  • A. Creating the view state occurs much later in the lifecycle, after expressions and method calls have been evaluated.
  • C. Evaluating expressions on the main page comes after custom component initialization, not immediately after controller constructors.
  • D. Sending HTML to the browser is the final step of the entire page lifecycle.

Question 46

Consider the Apex controller above, that is called from a Lightning Aura Component. What is wrong with it?

  1. Line 1: class must be global
  2. Lines 1 and 6: class and method must be global
  3. Line 6: method must be static
  4. Line 8: method must first serialize the list to JSON before returning
Show answer and explanation

Correct answer: C. Line 6: method must be static

When an Apex method is called from a Lightning Aura Component, the method must be declared as static. This is a fundamental requirement for Aura component controller methods because they need to be invoked without instantiating the class. The @AuraEnabled annotation marks the method as accessible to Lightning components, but static is still required. The class itself does not need to be global (public is sufficient), and the return type List<String> is automatically serialized by the framework without explicit JSON conversion.

Why the other options are wrong

  • A. The class only needs to be public, not global, for use with Lightning Aura Components.
  • B. While the method does need to be static, the class does not need to be global when it is public.
  • D. The framework automatically handles serialization of List objects when returned from @AuraEnabled methods; explicit JSON serialization is not required.

Question 47

A company uses an external system to manage its custom account territory assignments. Every quarter, millions of Accounts may be updated in Salesforce with new Owners when the territory assignments are completed in the external system. What is the optimal way to update the Accounts from the external system?

  1. Bulk API
  2. SOAP API
  3. Apex REST Web Service
  4. Composite REST API
Show answer and explanation

Correct answer: A. Bulk API

The Bulk API is the optimal choice for mass updating millions of records. It is specifically designed for high-volume data operations and can process data asynchronously in batches, making it far more efficient than synchronous APIs for large-scale updates like quarterly territory reassignments.

Why the other options are wrong

  • B. SOAP API is synchronous and not optimized for millions of record updates; it would hit Governor Limits and performance constraints.
  • C. Apex REST Web Service is custom and would require building infrastructure; it is not designed for bulk operations at this scale.
  • D. Composite REST API is useful for related operations but is not optimized for bulk updates to millions of records.

Question 48

What Visualforce tag can be used to display custom messages in pages using the Salesforce UI styling for errors, warnings, and other types of messages?

  1. <apex:customMessage>
  2. <apex:error>
  3. <apex:message>
  4. <apex:pageMessage>
Show answer and explanation

Correct answer: D. <apex:pageMessage>

The <apex:pageMessage> tag is the standard Visualforce component for displaying custom messages with Salesforce UI styling for various message types including errors, warnings, info, and success messages. It provides consistent styling that matches the Salesforce platform appearance.

Why the other options are wrong

  • A. apex:customMessage is not a valid Visualforce tag.
  • B. apex:error is not a standard tag for displaying styled messages; pageMessages is the correct component.
  • C. apex:message exists but is used within <apex:pageMessages> container; apex:pageMessage itself is the proper tag for this use case.

Question 49

A developer needs to create a Lightning page for entering Order Information. An error message should be displayed if the zip code entered as part of the Order's shipping address is not numeric. What is a recommended way for the error message be displayed to the end user?

  1. Use the apex:message tag to display errors
  2. Use the aura:component tag to display errors
  3. Use the ui:outputText tag to display errors
  4. Use the ui:inputDefaultError tag to display errors
Show answer and explanation

Correct answer: D. Use the ui:inputDefaultError tag to display errors

The ui:inputDefaultError tag is the recommended Lightning component for displaying validation errors associated with input fields. It provides built-in error messaging that displays below or near the input field and is specifically designed for form validation scenarios like the zip code validation described.

Why the other options are wrong

  • A. apex:message is a Visualforce tag, not a Lightning component, and is not appropriate for Lightning pages.
  • B. aura:component is a container tag for defining components, not a display mechanism for error messages.
  • C. ui:outputText is for displaying text output and does not provide error-specific styling or validation messaging capabilities.

Question 50

A developer is writing unit tests for the following method: public static Boolean isFreezing(String celsiusTemp){ if(String.isNotBlank(celsiusTemp) && celsiusTemp.isNumeric()) { return Decimal.valueof(celsiusTemp) <= 0; } return null; } Which assertion would be used in a negative test case?

  1. System.assertEquals(true, isFreezing(null))
  2. System.assertEquals (true, isFreezing('0')
  3. System.assertEquals(null, isFreezing('asdf'))
  4. System.assertEquals(true, isFreezing('IOO'))
Show answer and explanation

Correct answer: C. System.assertEquals(null, isFreezing('asdf'))

A negative test case validates that the method behaves correctly when given invalid input. The method returns null when the input is not blank and not numeric. Option C tests this by passing 'asdf' (non-numeric string), which should return null, confirming the method properly rejects invalid data.

Why the other options are wrong

  • A. This passes null, which returns null but is not truly negative testing of the numeric validation logic.
  • B. This tests a valid numeric input ('0'), which is a positive test case, not negative testing.
  • D. This passes 'IOO' which contains letters, but the assertion expects true, not the null that the method actually returns.

50 questions in. Want the rest? The first half of the pack, free by email · The full pack

Question 51

A developer is building a Visualforce page that interacts with external services. Which interface should the developer implement to test this functionality? (Choose two.)

  1. HTTPCalloutMock
  2. HTTPRequestMock
  3. HTTPResponseMock
  4. StaticResourceCalloutMock
Show answer and explanation

Correct answer: A, D. HTTPCalloutMock; StaticResourceCalloutMock

To test Visualforce pages that interact with external services via HTTP callouts, a developer must implement HTTPCalloutMock to mock HTTP requests and responses, and can use StaticResourceCalloutMock to mock HTTP responses using static resources. These interfaces allow the developer to simulate external service behavior without making actual external calls during testing. HTTPRequestMock and HTTPResponseMock are not valid interfaces in the Salesforce platform.

Why the other options are wrong

  • B. HTTPRequestMock is not a valid Salesforce interface for mocking HTTP callouts.
  • C. HTTPResponseMock is not a valid Salesforce interface for mocking HTTP callouts.

Question 52

What is the transaction limit on the max timeout for all callouts?

  1. 120 seconds
  2. 60 seconds
  3. 120 seconds (synchronous); 200 seconds (async)
  4. 60 seconds (synchronous); 200 seconds (async)
  5. There is no limit
Show answer and explanation

Correct answer: A. 120 seconds

The transaction limit on the maximum timeout for all callouts is 120 seconds total. This means the cumulative timeout for all HTTP callouts within a single transaction cannot exceed 120 seconds, preventing excessively long-running external requests.

Why the other options are wrong

  • B. 60 seconds is too low for the total callout timeout limit.
  • C. The timeout does not vary between synchronous and asynchronous callouts.
  • D. 200 seconds exceeds the actual callout timeout limit.
  • E. Salesforce enforces a 120-second aggregate timeout for callouts.

Question 53

A developer created a custom component to display an HTML table. The developer wants to be able to use the component on different Visualforce Pages and specify different header text for the table. Which tag should the developer use inside the component?

  1. <apex:variable>
  2. <apex:define>
  3. <apex:param>
  4. <apex:attribute>
Show answer and explanation

Correct answer: D. <apex:attribute>

The <apex:attribute> tag is used to define attributes on a custom Visualforce component. This allows the developer to specify properties that can be set when the component is used on different Visualforce pages, such as header text. Attributes enable component reusability by allowing different values to be passed in different contexts.

Why the other options are wrong

  • A. <apex:variable> is used to define local variables within a page or component, not to expose configurable attributes.
  • B. <apex:define> is used within custom components to define named content areas that can be filled by the calling page.
  • C. <apex:param> is used to pass parameters to certain tags like <apex:outputLink>, not to define component attributes.

Question 54

What is the transaction limit on the number of Apex jobs added to the queue?

  1. 100
  2. 150
  3. 50
  4. 200
  5. There is no limit
Show answer and explanation

Correct answer: C. 50

The transaction limit on the number of Apex jobs added to the queue (including @future, batch, and scheduled jobs) is 50. This limit prevents excessive queueing of asynchronous jobs within a single transaction and ensures manageable job processing.

Why the other options are wrong

  • A. 100 exceeds the actual job queue limit.
  • B. 150 is significantly above the limit.
  • D. 200 is well beyond the allowed job queuing limit.
  • E. Salesforce enforces a limit of 50 jobs that can be queued per transaction.

Question 55

A developer wants to call an Apex Server-side Controller from a Lightning Aura Component. What are two limitations to the data being returned by the Controller? (Choose two.)

  1. A custom Apex Class can be returned, but only the values of public instance properties and methods annotated with @AuraEnabled are serialized and returned.
  2. Lists of Custom Apex Classes cannot be returned by Apex Controllers called by Lightning Aura Components.
  3. Basic data types are supported, but defaults, such as maximum size for a number, are defined by the objects that they map to.
  4. Only Basic data types and sObjects are supported as return types for Apex Controllers called by Lightning Aura Components.
Show answer and explanation

Correct answer: A, C. A custom Apex Class can be returned, but only the values of public instance properties and methods annotated with @AuraEnabled are serialized and returned; Basic data types are supported, but defaults, such as maximum size for a number, are defined by the objects that they map to.

Option A is correct because custom Apex classes can be returned from Apex controllers, but only public instance properties and @AuraEnabled annotated methods are serialized and sent to the Lightning component. Option C is correct because basic data types are supported with defaults defined by their underlying object mappings (for example, numbers have maximum size constraints based on the Decimal or Integer object definitions). Lists of custom Apex classes can actually be returned, making B incorrect. Option D is too restrictive, custom classes can be returned beyond just basic types and sObjects.

Why the other options are wrong

  • B. Lists of custom Apex classes can be returned by Apex controllers called from Lightning Aura Components.
  • D. Custom Apex classes can be returned (not only basic types and sObjects), provided they have public properties or @AuraEnabled methods.

Question 56

A developer is trying to access org data from within a test class. Which sObject type requires the test class to have the (seeAllData=true) annotation?

  1. Report
  2. User
  3. Profile
  4. RecordType
Show answer and explanation

Correct answer: A. Report

Report is the sObject type that requires the seeAllData=true annotation in test classes. Reports are metadata-backed objects that exist in the org and cannot be created in test data; therefore, accessing real org reports requires seeAllData=true. User, Profile, and RecordType objects can be queried and referenced in tests without this annotation because they are accessible through standard test execution.

Why the other options are wrong

  • B. User records can be accessed in tests without seeAllData=true.
  • C. Profile records can be accessed in tests without seeAllData=true.
  • D. RecordType records can be accessed in tests without seeAllData=true.

Question 57

A developer is writing a Visualforce page that queries accounts in the system and presents a data table with the results. The users want to be able to filter the results based on up to five fields. However, the users want to pick the five fields to use as filter fields when they run the page. Which feature of Apex code is required to facilitate this solution?

  1. SOSL queries
  2. describeSObjects()
  3. Dynamic Schema binding
  4. REST API
Show answer and explanation

Correct answer: B. describeSObjects()

The describeSObjects() method allows developers to programmatically retrieve all available fields on an object and their metadata at runtime. This enables users to dynamically select which five fields to use as filters without hardcoding field names into the Visualforce page. The developer can use the describe results to build filter criteria dynamically. SOSL is for full-text search, Dynamic Schema binding refers to page references and component binding, and REST API is for external integration, none provide runtime field introspection.

Why the other options are wrong

  • A. SOSL queries perform full-text search and cannot enumerate object fields.
  • C. Dynamic Schema binding refers to binding Visualforce components to variables and objects, not to programmatically discovering field metadata.
  • D. REST API is for external system integration, not for introspecting local Salesforce object schemas.

Question 58

A developer has created a solution using the SOAP API for authenticating Communities users. What is needed when issuing the login() Call? (Choose two.)

  1. Organization Id
  2. Session Id
  3. Username and Password
  4. Security Token
Show answer and explanation

Correct answer: C, D. Username and Password; Security Token

When calling the login() method in the SOAP API for Communities users, both username and password are required credentials. A security token must be appended to the password for accounts with IP restrictions or when logging in from an unfamiliar location. Organization Id is not required for the login call itself. Session Id is a result of successful authentication, not an input parameter for the login method.

Why the other options are wrong

  • A. Organization Id is not a required parameter for the SOAP API login() call.
  • B. Session Id is returned after successful authentication, not provided as an input to the login method.

Question 59

Business rules require a Contact to always be created when a new Account is created. What can be used when developing a custom screen to ensure an Account is not created if the creation of the Contact fails?

  1. Use the Database.Delete method if the Contact insertion fails.
  2. Use the Database.Insert method with allOrNone set to False.
  3. Disable Validation rules on Contacts and set default values with a Trigger.
  4. Use setSavePoint() and rollback() with a try/catch block.
Show answer and explanation

Correct answer: D. Use setSavePoint() and rollback() with a try/catch block.

Using setSavePoint() and rollback() with a try/catch block provides atomic transaction control. If the Contact insertion fails in the catch block, the savepoint can be rolled back to undo the Account creation as well, ensuring both records are created together or neither is created. This maintains data consistency and business rule compliance.

Why the other options are wrong

  • A. Deleting the Account after Contact insertion fails is a workaround that may not execute if other failures occur; rollback is cleaner and more reliable.
  • B. Setting allOrNone to False allows partial success, which violates the requirement that both must succeed together.
  • C. Disabling Validation Rules and using Triggers to set defaults does not address transaction atomicity and may create incomplete Contact records.

Question 60

Which statement is true regarding both Flow and Lightning Process? (Choose two.)

  1. Can use Apex methods with the @InvocableMethod annotation
  2. Are both server-side considerations in the Order of Execution
  3. Can use Apex that implements the Process.Plugin interface
  4. Are able to be embedded directly into Visualforce pages
Show answer and explanation

Correct answer: A, B. Can use Apex methods with the @InvocableMethod annotation; Are both server-side considerations in the Order of Execution

Both Flow and Lightning Process can invoke Apex methods decorated with @InvocableMethod, allowing them to call custom Apex logic. Both are server-side constructs evaluated during the Order of Execution, meaning they run on the server and are subject to governor limits and execution order rules like triggers and validation rules. Process.Plugin is an older interface used by legacy Workflow, not by Flow or Lightning Process. Neither Flow nor Lightning Process can be directly embedded into Visualforce pages, though they can be invoked through actions.

Why the other options are wrong

  • C. Process.Plugin is specific to legacy Workflow processes, not Flow or Lightning Process.
  • D. Flow and Lightning Process cannot be directly embedded in Visualforce; they must be invoked through actions or called via Apex.

Question 61

A developer is working on code that requires a call to an external web service from a batch. How should the developer enable this functionality?

  1. Implement a custom System.CalloutException class
  2. Include Database.AllowCallout() in the class definition
  3. Implement an @future method for the callout, and invoke it from the batch
  4. Specify "callout=true" in the batch implementation
Show answer and explanation

Correct answer: B. Include Database.AllowCallout() in the class definition

To make callouts from Batch Apex, the batch class must implement the Database.AllowsCallouts interface in its class definition. The execute method can then make HTTP or web service callouts directly.

Why the other options are wrong

  • A. A custom exception class handles errors but does not enable callouts.
  • C. Future methods cannot be called from a batch job, so this approach fails.
  • D. There is no callout=true setting for batch classes, that annotation parameter applies to @future methods.

Question 62

What is the correct syntax for calling a controller action from a Visualforce page and updating part of the page once the action is completed? (Choose two.)

  1. <apex:commandFunction action="{!Save}" value="Save" rendered="thePageBlock"/>
  2. <apex:actionFunction action="{!Save}" name="Save" rerender="thePageBlock"/>
  3. <apex:commandButton action="{!Save}" value="Save" redraw="thePageBlock"/>
  4. <apex:actionSupport action="{!Save} " event="onchange" rerender="thePageBlock"/>
Show answer and explanation

Correct answer: B, D. <apex:actionFunction action="{!Save}" name="Save" rerender="thePageBlock"/>; <apex:actionSupport action="{!Save} " event="onchange" rerender="thePageBlock"/>

apex:actionFunction allows you to call a controller action from JavaScript and specify which components to rerender via the rerender attribute. apex:actionSupport is a component that adds AJAX support to other components, triggering an action on a specific event and rerendering specified components. Both are valid approaches for calling controller actions and updating portions of a Visualforce page dynamically.

Why the other options are wrong

  • A. apex:commandFunction does not exist; the correct component is apex:actionFunction. Additionally, it uses 'rendered' instead of 'rerender'.
  • C. apex:commandButton uses 'redraw' which is not a valid attribute; the correct attribute for partial page updates is 'rerender'.

Question 63

A developer must create a custom pagination solution. While users navigate through pages, if the data is changed from elsewhere, users should still see the cached results first accessed. How can the developer meet these requirements?

  1. Use @Cache annotation
  2. Use a StandardSetController
  3. Use OFFSET in SOQL queries
  4. Use OFFSET WITH CACHE in SOQL queries
Show answer and explanation

Correct answer: B. Use a StandardSetController

StandardSetController provides built-in pagination functionality that caches the result set from the initial query. When users navigate through pages using StandardSetController, they view the cached results from the first query execution, even if the underlying data has been modified elsewhere. This meets the requirement of showing users the cached results they initially accessed while navigating through pages.

Why the other options are wrong

  • A. @Cache annotation is used to cache Apex method results, not for maintaining paginated query result sets.
  • C. OFFSET in SOQL queries would execute new queries at each page navigation, fetching fresh data rather than cached results.
  • D. OFFSET WITH CACHE is not a valid SOQL clause; this syntax does not exist in Salesforce.

Question 64

An org has a requirement that an Account must always have one and only one Contact listed as Primary. So selecting one Contact will de-select any others. The client wants a checkbox on the Contact called 'Is Primary' to control this feature. The client also wants to ensure that the last name of every Contact is stored entirely in uppercase characters. What is the optimal way to implement these requirements?

  1. Write an after update trigger on Contact for the Is Primary logic and a separate before update trigger on Contact for the last name logic.
  2. Write a Validation Rule on the Contact for the Is Primary logic and a before update trigger on Contact for the last name logic.
  3. Write an after update trigger on Account for the Is Primary logic and a before update trigger on Contact for the last name logic.
  4. Write a single trigger on Contact for both after update and before update and callout to helper classes to handle each set of logic.
Show answer and explanation

Correct answer: D. Write a single trigger on Contact for both after update and before update and callout to helper classes to handle each set of logic.

Writing a single trigger on Contact with both after update and before update logic, delegating to helper classes, is optimal because it centralizes all Contact logic in one place, prevents recursion issues, maintains separation of concerns through helpers, and handles both requirements efficiently. Before update logic converts last names to uppercase (data transformation), while after update logic manages the primary contact relationship across records. A single trigger prevents multiple trigger execution issues and improves maintainability.

Why the other options are wrong

  • A. Separate triggers can cause recursion and execution order issues; consolidating into one trigger with proper logic flow is better.
  • B. Validation Rules cannot implement the primary contact de-selection logic; they can only prevent invalid saves, not update other records.
  • C. The primary contact logic should be on Contact, not Account, since the Is Primary checkbox is a Contact field and the update affects Contact records.

Question 65

The progress of an apex job queued is using the System.enqueueJob method and needs to be monitored. Which options are valid? (Choose two.)

  1. Use the Apex Jobs page in setup
  2. Query the Queueable Apex record
  3. Query the AsyncApexJob record
  4. Use the Scheduled Jobs page in setup
Show answer and explanation

Correct answer: A, C. Use the Apex Jobs page in setup; Query the AsyncApexJob record

The Apex Jobs page in Setup displays all queued and scheduled jobs, including Queueable Apex jobs, allowing real-time monitoring of job progress. Querying the AsyncApexJob sObject provides programmatic access to job status, execution details, and error information for jobs enqueued with System.enqueueJob(). These two methods cover both administrative and programmatic monitoring approaches.

Why the other options are wrong

  • B. There is no Queueable Apex record sObject; job metadata is stored in AsyncApexJob.
  • D. The Scheduled Jobs page displays scheduled Apex jobs, not queued Queueable jobs; Queueable jobs appear on the Apex Jobs page.

Question 66

What is a benefit of JavaScript remoting over Visualforce Remote Objects?

  1. Allows for specified rerender targets
  2. Does not require any Apex code
  3. Does not require any JavaScript code
  4. Supports complex server-side application logic
Show answer and explanation

Correct answer: D. Supports complex server-side application logic

JavaScript remoting allows direct invocation of Apex methods from JavaScript, enabling developers to implement complex server-side business logic that can be called from the client. Remote Objects provide a simplified, object-centric interface but are more limited in handling complex application logic. Remote Objects abstract away Apex code entirely by working directly with objects, whereas JavaScript remoting requires Apex and allows for sophisticated logic execution on the server before returning results.

Why the other options are wrong

  • A. Rerender targets are a Visualforce concept and apply to both remoting and remote objects equally.
  • B. JavaScript remoting requires Apex code to define the methods being called, so this is an advantage of Remote Objects, not remoting.
  • C. JavaScript remoting does require JavaScript client-side code, so this is not an advantage compared to Remote Objects.

Question 67

Code must have X% overall code coverage.

  1. X = 100
  2. X = 75
  3. X = 65
  4. X = 50
Show answer and explanation

Correct answer: B. X = 75

Salesforce requires a minimum of 75% code coverage for deployments to production. While 100% coverage is ideal, it is not mandated. The 75% threshold ensures adequate testing while remaining achievable for most projects.

Why the other options are wrong

  • A. 100% coverage is a best practice goal, not a requirement.
  • C. 65% is below the minimum Salesforce requirement.
  • D. 50% is well below the required threshold.

Question 68

If you wanted to create a record following the update of another (with data from the source object), what is the most customizable approach?

  1. Workflow Rule
  2. Process Builder
  3. After update Trigger
  4. Flow
Show answer and explanation

Correct answer: D. Flow

Flow offers the greatest customization for creating a record after another is updated, with access to complex logic, conditional branching, loops, and direct data manipulation. While Process Builder and Workflow Rules provide declarative automation, Flow provides superior flexibility and control. After-update triggers offer programmatic customization but Flow is increasingly the recommended approach for complex business logic in modern Salesforce development.

Why the other options are wrong

  • A. Workflow Rules have limited capabilities and cannot create records as effectively as more modern tools.
  • B. Process Builder is more customizable than Workflow Rules but less flexible than Flow for complex scenarios.
  • C. While After Update triggers are highly customizable, Flow is the recommended declarative alternative that provides better maintainability and integration with Salesforce features.

Question 69

What is the transaction limit on the number of callouts?

  1. 100
  2. 150
  3. 50
  4. 200
  5. There is no limit
Show answer and explanation

Correct answer: A. 100

The transaction limit for callouts in Salesforce is 100. This includes both synchronous and asynchronous callouts made within a single transaction. Callouts consume significant resources, so this limit prevents excessive external service requests.

Why the other options are wrong

  • B. 150 exceeds the actual callout limit.
  • C. 50 is too low for the callout limit.
  • D. 200 is double the actual limit.
  • E. Salesforce enforces a strict limit on callout invocations.

Question 70

A developer must create a way for external partners to submit millions of leads into Salesforce per day. How should the developer meet this requirement?

  1. Publicly expose a Visualforce page via Force.com Sites
  2. Create a web service on Heroku that uses Heroku Connect
  3. Host a Web-to-Lead form on the company website
  4. Publicly expose an Apex Web Service via Force.com Sites
Show answer and explanation

Correct answer: B. Create a web service on Heroku that uses Heroku Connect

Heroku Connect provides a robust solution for syncing millions of records between external systems and Salesforce with built-in handling for high-volume operations, data transformation, and reliability. A web service on Heroku using Heroku Connect can efficiently handle the millions of leads per day requirement with proper queuing, batching, and error handling that direct Salesforce APIs cannot manage at this scale.

Why the other options are wrong

  • A. Exposing a Visualforce page via Sites is not designed for high-volume programmatic lead submission and would face governor limits.
  • C. Web-to-Lead forms are designed for modest volumes, not millions of leads per day, and lack the robustness needed at enterprise scale.
  • D. An Apex Web Service via Sites would encounter the same governor limit constraints as Visualforce and cannot handle millions of daily requests.

Question 71

A company represents their customers as Accounts in Salesforce. All customers have a unique Customer_Number__c that is unique across all of the company's systems. They also have a custom Invoice__c object, with a Lookup to Account, to represent invoices that are sent out from their external system. This company wants to integrate invoice data back into Salesforce so Sales Reps can see when a customer is paying their bills on time. What is the optimal way to implement this?

  1. Ensure Customer_Number__c is an External ID and that a custom field Invoice_Number__c is an External ID and Upsert invoice data nightly.
  2. Query the Account Object upon each call to insert invoice data to fetch the Salesforce ID corresponding to the Customer Number on the invoice.
  3. Create a cross-reference table in the custom invoicing system with the Salesforce Account ID of each Customer and insert invoice data nightly.
  4. Use Salesforce Connect and external data objects to seamlessly import the invoice data into Salesforce without custom code.
Show answer and explanation

Correct answer: A. Ensure Customer_Number__c is an External ID and that a custom field Invoice_Number__c is an External ID and Upsert invoice data nightly.

Marking Customer_Number__c as an External ID on Account and Invoice_Number__c as an External ID on Invoice__c, then performing nightly upserts, is the optimal solution. External IDs enable Salesforce to match records from external systems without needing to maintain Salesforce IDs in external systems. Upsert operations efficiently handle both new invoice inserts and updates to existing invoices based on these external identifiers.

Why the other options are wrong

  • B. Querying the Account object on each call is inefficient, creates unnecessary API calls, and doesn't scale well for bulk invoice data loads.
  • C. Maintaining a cross-reference table in the external system adds complexity and creates a manual maintenance burden instead of using Salesforce's native external ID feature.
  • D. Salesforce Connect is designed for real-time data access to external systems, not for importing and storing invoice data persistently in Salesforce.

Question 72

How many Territories can an instance of salesforce have?

  1. 400
  2. 200
  3. 1000
  4. 100
  5. 500
Show answer and explanation

Correct answer: C. 1000

A Salesforce instance can have a maximum of 1000 territories configured. This limit applies to the total number of territories that can be created within an organization's territory management setup.

Why the other options are wrong

  • A. 400 territories is below the actual maximum limit.
  • B. 200 territories is below the actual maximum limit.
  • D. 100 territories is below the actual maximum limit.
  • E. 500 territories is below the actual maximum limit.

Question 73

Where in a query can you use Geolocation and Distance? (Choose two.)

  1. Select clause
  2. Filter clause
  3. Order By clause
  4. Group By clause
Show answer and explanation

Correct answer: B, C. Filter clause; Order By clause

Geolocation and distance calculations in SOQL can be used in the Filter clause (WHERE conditions to find records within a distance) and the Order By clause (to sort results by distance from a location). They cannot be used in the Select clause or Group By clause.

Why the other options are wrong

  • A. Geolocation distance cannot be used directly in the Select clause; you must use it in filtering or sorting instead.
  • D. Geolocation and distance are not supported in the Group By clause for aggregation purposes.

Question 74

The Bulk API __________.

  1. Is based on REST principles and is optimized for loading or deleting large sets of data. You can use it to query, queryAll, insert, update, upsert, or delete many records asynchronously by submitting batches
  2. Provides a powerful, convenient, and simple REST-based web services interface for interacting with Salesforce. Its advantages include ease of integration and development, and it's an excellent choice of technology for use with mobile applications and web projects
  3. Is used to create, retrieve, update or delete records, such as accounts, leads, and custom objects, and allows you to maintain passwords, perform searches, and much more
  4. Is used to retrieve, deploy, create, update, or delete customizations for your org. The most common use is to migrate changes from a sandbox or testing org to your production environment
Show answer and explanation

Correct answer: A. Is based on REST principles and is optimized for loading or deleting large sets of data. You can use it to query, queryAll, insert, update, upsert, or delete many records asynchronously by submitting batches

The Bulk API is based on REST principles and is optimized for asynchronously loading or deleting large sets of data through batch submissions, supporting query, queryAll, insert, update, upsert, and delete operations.

Why the other options are wrong

  • B. This describes the REST API, which focuses on ease of integration.
  • C. This describes the SOAP API, which handles individual record operations.
  • D. This describes the Metadata API, which handles customization deployments.

Question 75

A developer needs to create a service that will process an email sent to it and create an account and contact using the contents of the email as data for the records. How might a developer accomplish this requirement?

  1. Use the Apex Inbound Email Handler
  2. Use the Fuel API with Email Data Extensions
  3. Use Heroku Data Clips to Process Email
  4. Use Auto-launched Flow and Process Builder
Show answer and explanation

Correct answer: A. Use the Apex Inbound Email Handler

The Apex Inbound Email Handler is the standard Salesforce mechanism for processing emails sent to a designated email address. It allows developers to write Apex code that receives the email content and creates records like accounts and contacts based on the email data.

Why the other options are wrong

  • B. Fuel API with Email Data Extensions is a Marketing Cloud feature, not a Salesforce platform feature for processing inbound emails.
  • C. Heroku Data Clips is not a Salesforce feature for processing emails or creating records.
  • D. While Flow and Process Builder can create records, they are not designed to receive and parse inbound emails directly.

75 questions in. Want the rest? The first half of the pack, free by email · The full pack

Question 76

During the order of execution of a Visualforce page GET request, what happens after this step? Evaluate constructors on controllers and extensions

  1. Evaluate constructors and expressions on custom components
  2. Create view state if <apex: form> exists
  3. Send the HTML response to the browser
  4. Evaluate expressions, action attributes, and method calls
Show answer and explanation

Correct answer: A. Evaluate constructors and expressions on custom components

In the Visualforce page execution lifecycle, after evaluating constructors on controllers and extensions, the next step is to evaluate constructors and expressions on custom components. This allows custom components to be initialized before the page proceeds to other phases like view state creation.

Why the other options are wrong

  • B. View state creation happens later in the execution order, after custom components are evaluated.
  • C. The HTML response is sent to the browser at the end of the lifecycle, not immediately after controller construction.
  • D. Expressions, action attributes, and method calls are evaluated in parallel with constructors, not sequentially after them.

Question 77

A user receives the generic "An internal server error has occurred" while interacting with a custom Lightning Component. What should the developer do to ensure a more meaningful message?

  1. Add an onerror event handler to the tag.
  2. Add an error-view component to the markup.
  3. Use an AuraHandledException in a try/catch block.
  4. Use ProcessBuilder to catch the error.
Show answer and explanation

Correct answer: C. Use an AuraHandledException in a try/catch block.

AuraHandledException is specifically designed to pass meaningful error messages from the server to the client in Lightning Components. When thrown in a try/catch block in an Apex controller method called from a component, it displays the custom message to the user instead of the generic 'internal server error'. This is the standard Salesforce approach for providing user-friendly error messages.

Why the other options are wrong

  • A. The onerror event handler on a component tag is for handling component-level errors, not server-side Apex errors.
  • B. There is no 'error-view' component in Lightning; this is not a valid Salesforce component.
  • D. ProcessBuilder is a flow automation tool and cannot catch errors from Lightning Components in any meaningful way.

Question 78

What is the transaction limit on the max Salesforce CPU time?

  1. 100 seconds
  2. 60 seconds
  3. 100 seconds (synchronous); 200 seconds (async)
  4. 10 seconds (synchronous); 60 seconds (async)
  5. There is no limit
Show answer and explanation

Correct answer: D. 10 seconds (synchronous); 60 seconds (async)

The transaction limit on Salesforce CPU time is 10 seconds for synchronous operations and 60 seconds for asynchronous operations. These limits ensure that no single transaction monopolizes system resources and that the platform remains responsive for all users.

Why the other options are wrong

  • A. 100 seconds is much higher than the actual synchronous limit.
  • B. 60 seconds applies only to asynchronous operations, not synchronous.
  • C. The values are inverted; this does not reflect actual CPU time limits.
  • E. CPU time limits are strictly enforced in Salesforce transactions.

Question 79

What is the best way to display field-level error messages in Lightning?

  1. ui:inputDefaultError
  2. ui:outputText
  3. aura:component
  4. apex:message
Show answer and explanation

Correct answer: A. ui:inputDefaultError

The ui:inputDefaultError component is specifically designed to display field-level error messages in Lightning components with proper Salesforce styling and formatting.

Why the other options are wrong

  • B. ui:outputText displays text output but is not designed for error messaging.
  • C. aura:component is a base component definition, not an error display mechanism.
  • D. apex:message is a Visualforce component, not used in Lightning components.

Question 80

The test method above calls a web service that updates an external system with Account information and sets the Account's Integration_Updated__c checkbox to True when it completes. The test fails to execute and exits with an error: "Methods defined as TestMethod do not support Web service callouts. " What is the optimal way to fix this?

  1. Add Test.startTest() before and Test.setMock and Test.stopTest() after CalloutUtil.sendAccountUpdate.
  2. Add Test.startTest() and Test.setMock before and Test.stopTest() after CalloutUtil.sendAccountUpdate.
  3. Add if (!Test.isRunningTest()) around CalloutUtil.sendAccountUpdate.
  4. Add Test.startTest() before and Test.stopTest() after CalloutUtil.sendAccountUpdate.
Show answer and explanation

Correct answer: B. Add Test.startTest() and Test.setMock before and Test.stopTest() after CalloutUtil.sendAccountUpdate.

In Salesforce, test methods cannot make actual web service callouts. To test code that calls external services, you must use Test.startTest() and Test.stopTest() to establish a testing context, and you must use Test.setMock() to provide a mock HTTP response before the callout occurs. The mock must be set between startTest() and stopTest(), and before the actual callout method is invoked. Option B correctly places Test.setMock before CalloutUtil.sendAccountUpdate within the test context boundaries, allowing the mock to intercept the callout and return a simulated response, enabling the test to execute successfully.

Why the other options are wrong

  • A. Test.setMock must be placed between startTest() and stopTest(), not after the callout, making this ordering incorrect.
  • C. Using if (!Test.isRunningTest()) skips the callout during tests entirely, which defeats the purpose of testing the callout logic and doesn't verify the Integration_Updated__c update behavior.
  • D. While startTest() and stopTest() are necessary, without Test.setMock() to provide a mock HTTP response, the actual callout still cannot execute and the test will fail with the same error.

Question 81

1 Contact con = new Contact( LastName ='Smith', Department = 'Admin') 2 insert con; 3 Contact insertedContact=[select Name from Contact where id=:con. Id]; 4 Savepoint sp_admin = Database.setSavepoint(); 5 con. Department = 'HR'; 6 update con; 7 Database.rollback(sp_admin); 8 System.debug(Limits.getDmlStatements()); Given the following code, what value will be output in the logs by line #8?

  1. 5
  2. 3
  3. 4
  4. 2
Show answer and explanation

Correct answer: C. 4

Limits.getDmlStatements() returns the number of DML statements used so far in the transaction, and four count here. Line 2, insert: 1. Line 4, Database.setSavepoint(): 2, because each savepoint set counts against the DML statement limit. Line 6, update: 3. Line 7, Database.rollback(): 4, because each rollback also counts against the DML statement limit. The SOQL query on line 3 counts against the SOQL query limit, not the DML limit, and rolling back does not reset any governor limit counter. Line 8 logs 4.

Why the other options are wrong

  • A. 5 would need one more DML operation; the SOQL query on line 3 is not a DML statement.
  • B. 3 misses one DML operation: the insert, the update, Database.setSavepoint() and Database.rollback() each count, for a total of 4.
  • D. 2 counts only the insert and the update, but Database.setSavepoint() and Database.rollback() each count as a DML statement too.

Question 82

A developer is writing a complex application involving triggers, workflow rules, Apex classes, and processes. The developer needs to carefully consider the order of execution when developing the application. 1. Before Triggers 2. After Triggers 3. Post commit logic such as sending email 4. DML committed to the database 5. Workflow rules 6. Roll-up summary calculations In what order do the following operations execute?

  1. 1, 2, 5, 6, 4, 3
  2. 1, 5, 6, 2, 4, 3
  3. 1, 2, 4, 5, 6, 3
  4. 1, 6, 5, 2, 4, 3
Show answer and explanation

Correct answer: A. 1, 2, 5, 6, 4, 3

In Salesforce, the order of execution is: Before Triggers execute first, then After Triggers, then Workflow Rules and Process Builder actions, then Roll-up Summary calculations, then the DML is committed to the database, and finally Post Commit Logic such as sending emails executes. This order ensures data validation occurs before commit and post-commit actions only fire after the transaction is successfully persisted.

Why the other options are wrong

  • B. Workflow rules execute after After Triggers, not before, and Roll-up Summary calculations occur before DML commit, not after.
  • C. DML must be committed before Workflow Rules and Roll-up Summary calculations execute; this option places commit too early.
  • D. Roll-up Summary calculations do not execute before After Triggers; they occur in the middle of the execution sequence after After Triggers.

Question 83

UC Loans is a small company with a part time Salesforce administrator. UC Loans wants to create a Loan__c record whenever an Opportunity is won. What is the optimal solution for UC Loans to accomplish this?

  1. Process Builder
  2. Quick Action
  3. Workflow Rule
  4. Apex Trigger
Show answer and explanation

Correct answer: A. Process Builder

Process Builder is the optimal solution for a small company with a part-time administrator because it requires no coding, provides a visual interface, and easily handles the straightforward requirement of creating a Loan record when an Opportunity reaches the won stage. Process Builder is more maintainable and user-friendly than Apex Triggers for declarative automation tasks. It offers sufficient functionality for this use case without requiring developer resources.

Why the other options are wrong

  • B. Quick Actions are used for user-initiated manual actions, not for automatic record creation based on stage changes.
  • C. Workflow Rules cannot create records; they can only perform updates, send emails, create tasks, or send outbound messages.
  • D. Apex Trigger is overly complex for a part-time administrator to maintain and requires developer resources unnecessarily.

Question 84

What is the correct order of execution for Visualforce Page "get" requests (initial page visit)?

  1. 1) Evaluate constructors on controller and extensions 2) If there's a <apex:form> element, create the view state 3) Evaluate expressions, <apex:page> attribute actions, and other method calls (getters/setters) on main page 4) Evaluate constructors, extensions, and expression on attribute definitions on any custom components present 5) Send HTML to Browser
  2. 1) Evaluate constructors, extensions, and expression on attribute definitions on any custom components present 2) Evaluate constructors on controller and extensions 3) Evaluate expressions, <apex:page> attribute actions, and other method calls (getters/setters) on main page 4) If there's a <apex:form> element, create the view state 5) Send HTML to Browser
  3. 1) Evaluate constructors on controller and extensions 2) Evaluate constructors, extensions, and expression on attribute definitions on any custom components present 3) Evaluate expressions, <apex:page> attribute actions, and other method calls (getters/setters) on main page 4) If there's a <apex:form> element, create the view state 5) Send HTML to Browser
Show answer and explanation

Correct answer: C. 1) Evaluate constructors on controller and extensions 2) Evaluate constructors, extensions, and expression on attribute definitions on any custom components present 3) Evaluate expressions, <apex:page> attribute actions, and other method calls (getters/setters) on main page 4) If there's a <apex:form> element, create the view state 5) Send HTML to Browser

When a Visualforce page is initially requested, the execution order is: first the main controller and extension constructors are evaluated, then any custom component constructors and their expressions are processed, followed by evaluation of page expressions and getters/setters, then the view state is created if a form exists, and finally the HTML is sent to the browser. This ensures all dependencies are initialized before expressions are evaluated and the view state captures the current state.

Why the other options are wrong

  • A. This incorrectly places view state creation before evaluating custom component constructors and expressions.
  • B. This incorrectly places custom component evaluation before main controller constructor evaluation, which would fail since components may depend on controller state.

Question 85

Example 1: AggregateResult[] groupedResults = [SELECT CampaignId, AVG(Amount) FROM Opportunity GROUP BY CampaignId]; for (AggregateResult ar : groupedResults) { System.debug('Campaign ID' + ar.get('CampaignId')); System.debug('Average amount' + ar.get('expr0')); } Example 2: AggregateResult[] groupedResults = [SELECT CampaignId, AVG(Amount) theAverage FROM Opportunity GROUP BY CampaignId]; for (AggregateResult ar : groupedResults) { System.debug('Campaign ID' + ar.get('CampaignId')); System.debug('Average amount' + ar.get('theAverage')); } Example 3: AggregateResult[] groupedResults = [SELECT CampaignId, AVG(Amount) FROM Opportunity GROUP BY CampaignId]; for (AggregateResult ar : groupedResults) { System.debug('Campaign ID' + ar.get('CampaignId')); System.debug('Average amount' + ar.get.AVG()); } Example 4: AggregateResult[] groupedResults = [SELECT CampaignId, AVG(Amount) theAverage FROM Opportunity GROUP BY CampaignId]; for (AggregateResult ar : groupedResults) { System.debug('Campaign ID' + ar.get('CampaignId')); System.debug ('Average amount' + ar.theAverage); } Which two of the examples above have correct System.debug statements? (Choose two.)

  1. Example 1
  2. Example 2
  3. Example 3
  4. Example 4
Show answer and explanation

Correct answer: A, B. Example 1; Example 2

Example 1 correctly accesses the unnamed aggregate function using the default alias expr0. Example 2 correctly uses a custom alias (theAverage) assigned in the SOQL query and retrieves it via get('theAverage'). Both are valid approaches for accessing aggregate results. Examples 3 and 4 use invalid syntax that does not exist in the AggregateResult API.

Why the other options are wrong

  • C. get.AVG() is not a valid method on AggregateResult; aggregate functions must be accessed by their alias string via get().
  • D. Direct property access like ar.theAverage does not work; AggregateResult requires get() method calls to retrieve values.

Question 86

A developer writes the following Apex trigger so that when a Case is closed, a single Survey record is created for that Case. The issue is that multiple Survey_c records are being created per Case. trigger CaseTrigger on Case (after insert, after update){ List<Survey_c> createSurveys = new List<Survey_c>(); for (Case c : trigger.new){ if (c.IsClosed && (trigger.isInsert II trigger.isUpdate && trigger.oldMap.get(c.Id).IsClosed == false)){ createSurveys.add(new Survey_c(Case_c = c.Id)); } } insert createSurveys; } What could be the cause of this issue?

  1. A user is creating the record as Closed
  2. A workflow rule is firing with a Create Task action
  3. A workflow rule is firing with a Field Update action
  4. A user is editing the record multiple times
Show answer and explanation

Correct answer: C. A workflow rule is firing with a Field Update action

A workflow rule with a Field Update action on the Case object can cause the trigger to fire multiple times. When a workflow rule performs a field update, it re-saves the record, which fires the after update trigger again. Since the trigger checks if IsClosed changed from false to true, each workflow-initiated update that doesn't change IsClosed won't create a survey, but if the workflow updates any field on the closed case, it fires the trigger again with the same closed status, creating duplicate surveys. A workflow rule with a Create Task action would not cause duplicate Survey records.

Why the other options are wrong

  • A. A user creating the record as closed would fire the trigger only once on insert.
  • B. A workflow rule with Create Task action does not modify the Case record and would not cause the trigger to fire multiple times.
  • D. Multiple edits by a user would trigger the survey creation logic multiple times, but the code's condition prevents surveys from being created on subsequent updates unless IsClosed changes from false to true.

Question 87

Which interface needs to be implemented by a Lightning Component so that it may be displayed in modal dialog by clicking a button on a Lightning Record page?

  1. force:lightningQuickAction
  2. lightning:quickAction
  3. lightning:editAction
  4. force:lightningEditAction
Show answer and explanation

Correct answer: A. force:lightningQuickAction

The force:lightningQuickAction interface is the correct one to implement for a Lightning Component to be displayed in a modal dialog when clicked from a button on a Lightning Record page. This interface allows Lightning components to be used as quick actions within the Salesforce UI.

Why the other options are wrong

  • B. lightning:quickAction is not the correct interface name for this use case; the correct namespace is force.
  • C. lightning:editAction is not a valid interface for displaying components in modal dialogs from record page buttons.
  • D. force:lightningEditAction is not the correct interface; the proper one is force:lightningQuickAction.

Question 88

A developer is using a third-party JavaScript library to create a custom user interface in Visualforce. The developer needs to use JavaScript to get data from a controller method in response to a user action. How can the developer accomplish this?

  1. Use <apex:actionFunction> to create a JavaScript wrapper for the controller method
  2. Use the @RemoteAction annotation on the method definition with JavaScript Remoting
  3. Use the $Controller global variable to access the controller method via JavaScript
  4. Use <apex:actionSupport> to enable JavaScript support for the controller method
Show answer and explanation

Correct answer: B. Use the @RemoteAction annotation on the method definition with JavaScript Remoting

The @RemoteAction annotation combined with JavaScript Remoting allows a developer to call controller methods directly from JavaScript in response to user actions. This provides a clean, asynchronous way to invoke server-side methods and receive data back in the client-side code. The @RemoteAction annotation exposes controller methods to JavaScript and handles the serialization/deserialization of data.

Why the other options are wrong

  • A. <apex:actionFunction> creates a JavaScript function but is primarily designed for form submission and component interaction rather than direct method invocation with return values.
  • C. $Controller is not a valid global variable for accessing controller methods; it does not provide this functionality.
  • D. <apex:actionSupport> provides event handling and partial page refresh capabilities but does not enable direct JavaScript method calls to retrieve data asynchronously.

Question 89

If the "PageReference.setRedirect" Apex function is set to True, what type of request is made?

  1. Get request
  2. Postback request
  3. If PageReference points to the same controller and subset of extensions, postback request, otherwise get request
Show answer and explanation

Correct answer: A. Get request

When PageReference.setRedirect is set to True, a GET request is made. This performs a true redirect at the browser level, which always uses the GET HTTP method regardless of the controller type or page context.

Why the other options are wrong

  • B. A postback request is used when setRedirect is False, not True.
  • C. The redirect behavior is not conditional based on controller type; True always generates a GET request.

Question 90

A large company uses Salesforce across several departments. Each department has its own Salesforce Administrator. It was agreed that each Administrator would have their own sandbox in which to test changes. Recently, users notice that fields that were recently added for one department suddenly disappear without warning. Also, Workflows that once sent emails and created tasks no longer do so. Which two statements are true regarding these issues and resolution? (Choose two.)

  1. The administrators are deploying their own Change Sets, thus deleting each other's fields from the objects in production.
  2. A sandbox should be created to use as a unified testing environment instead of deploying Change Sets directly to production.
  3. Page Layouts should never be deployed via Change Sets, as this causes Workflows and Field-level Security to be reset and fields to disappear.
  4. The administrators are deploying their own Change Sets over each other, thus replacing entire Page Layouts and Workflows in Production.
Show answer and explanation

Correct answer: B, D. A sandbox should be created to use as a unified testing environment instead of deploying Change Sets directly to production; The administrators are deploying their own Change Sets over each other, thus replacing entire Page Layouts and Workflows in Production.

When multiple administrators deploy Change Sets directly to production without coordination, they overwrite each other's changes because Change Sets deploy entire components (fields, workflows, page layouts) as units. Option B is correct because a unified testing sandbox would allow administrators to test and coordinate changes before production deployment, preventing conflicts. Option D is correct because administrators deploying Change Sets over each other replace entire Workflows and Page Layouts, causing fields to disappear and automations to stop functioning. Option A is misleading because Change Sets don't delete fields from objects simply by deployment. Option C is incorrect because Page Layouts can be deployed via Change Sets; the issue is uncoordinated deployments, not the deployment method itself.

Why the other options are wrong

  • A. Change Sets do not delete fields from objects; they replace page layouts and workflows that reference fields, but the fields themselves persist.
  • C. Page Layouts can be deployed via Change Sets without inherently causing Workflows or Field-level Security to reset; the issue is overlapping deployments, not the deployment mechanism.

Question 91

What are the ways a developer can create test data of Contacts? (Choose two.)

  1. Test.createTestData()
  2. myDataFactory.createContacts(10)
  3. Test.loadData(Contact.sObjectType, 'staticResource')
  4. Test.loadTestRecords(Contact.sObjectType, 'staticResource')
Show answer and explanation

Correct answer: B, C. myDataFactory.createContacts(10); Test.loadData(Contact.sObjectType, 'staticResource')

Developers can create test data using Test.loadData() with a static resource containing CSV data (option C), and they can use custom data factory classes like myDataFactory.createContacts(10) (option B) that encapsulate creation logic. Test.createTestData() and Test.loadTestRecords() are not valid Salesforce Apex methods.

Why the other options are wrong

  • A. Test.createTestData() is not a valid Apex method in the Salesforce testing framework.
  • D. Test.loadTestRecords() is not a valid Salesforce method; the correct method is Test.loadData().

Question 92

A company notices that their unit tests in a test class with many methods to create many records for prerequisite reference data are slow. What can a developer to do address the issue?

  1. Move the prerequisite reference data setup to a TestDataFactory and call that from each test method.
  2. Move the prerequisite reference data setup to a @testSetup method in the test class.
  3. Move the prerequisite reference data setup to a static method in the test class and call that from each test method.
  4. Move the prerequisite reference data setup to the constructor for the test class.
Show answer and explanation

Correct answer: B. Move the prerequisite reference data setup to a @testSetup method in the test class.

The @testSetup annotation creates test data once per test class and shares it across all test methods, dramatically improving performance. Data created in @testSetup is automatically rolled back after each test method, so tests remain isolated. A TestDataFactory requires calling it from each method (redundant setup per test), static methods also execute per test method call, and constructors are not ideal for test data creation. The @testSetup annotation is the Salesforce best practice for this exact scenario.

Why the other options are wrong

  • A. Calling TestDataFactory from each test method still executes the setup code for every test, not providing the performance benefit of shared setup.
  • C. Static methods called from each test method still execute the setup code repeatedly, negating the performance improvement.
  • D. Test class constructors are not the intended mechanism for test data setup and do not provide the isolation and reuse benefits of @testSetup.

Question 93

Choose the correct definition for <apex:actionSupport>.

  1. Allows for controller methods to be called directly from Javascript. Must be encapsulated in <apex:form> tags. Unlike actionSupport, these function<apex:actionPoller>s can be called directly from Javascript code
  2. Sends an AJAX request according to the time interval you specify. If this ever gets re-rendered, it resets
  3. Adds AJAX support to another component (e.g. onClick, onMouseUp, onFocus, etc.)
  4. Can be associated with an AJAX request (actionFunction/actionSupport/actionPoller) and shows content conditionally depending on the status of the request (in progress/complete). Use the "id" field to specify name; use "status" field on related components to connect them
  5. Signifies which components should be processed by the server when an AJAX request is generated
Show answer and explanation

Correct answer: C. Adds AJAX support to another component (e.g. onClick, onMouseUp, onFocus, etc.)

The <apex:actionSupport> component adds AJAX support to other components by attaching to their events, such as onClick, onMouseUp, onFocus, onBlur, and others. It allows those events to trigger server-side controller methods without full page refresh.

Why the other options are wrong

  • A. That describes <apex:actionFunction>, which allows direct JavaScript invocation.
  • B. That describes <apex:actionPoller>, which sends requests at timed intervals.
  • D. That describes <apex:actionStatus>, which shows conditional content based on request state.
  • E. That describes <apex:actionRegion>, which specifies which components to process in requests.

Question 94

A developer wishes to improve runtime performance of Apex calls by caching results on the client. What is the best way to implement this?

  1. Decorate the server-side method with @AuraEnabled(cacheable=true).
  2. Set a cookie in the browser for use upon return to the page.
  3. Call the setStorable() method on the action in the JavaScript client-side code.
  4. Decorate the server-side method with @AuraEnabled(storable=true).
Show answer and explanation

Correct answer: A. Decorate the server-side method with @AuraEnabled(cacheable=true).

The @AuraEnabled(cacheable=true) annotation is the standard and best practice way to enable client-side caching of server-side method results in Lightning. When a method is marked cacheable, the Lightning framework automatically caches results on the client and reuses them for identical requests, improving performance without requiring manual cache management code. This is the declarative, framework-supported approach.

Why the other options are wrong

  • B. Cookies are a browser storage mechanism but are not the optimal Salesforce-recommended approach for caching Lightning component data.
  • C. setStorable() is a legacy method from Aura that has been superseded by the cacheable parameter in @AuraEnabled.
  • D. The correct parameter is cacheable, not storable, when using @AuraEnabled for caching purposes.

Question 95

Recently a Salesforce org's integration failed because it exceeded the number of allowed API calls in a 24-hour period. The integration handles a near real-time, complex insertion of data into Salesforce. The flow of data is as follows: • The integration looks up Contact records with a given email address and, if found, the integration adds a Task to the first matching Contact it finds. • If a match is not found, the integration looks up Lead records with a given email address and, if found, the integration adds a Task to the first matching Lead it finds. • If a match is not found, the integration will create a Lead and a Task for that newly created Lead. What is one way in which the integration can stay near real-time, but not exceed the number of allowed API calls in a 24-hour period?

  1. Use the REST API as well as the SOAP API to effectively double the API calls allowed in a 24-hour period.
  2. Create an Inbound Message that, using Flow, can do all of the logic the integration code was doing.
  3. Write a custom Apex web service that, given an email address, does all of the logic the integration code was doing.
  4. Create several Apex InboundEmailHandlers to accept calls from the third-party system, thus bypassing the API limits.
Show answer and explanation

Correct answer: C. Write a custom Apex web service that, given an email address, does all of the logic the integration code was doing.

Creating a custom Apex web service endpoint that handles all the integration logic (Contact lookup, Lead lookup, Task creation) in a single server-side transaction reduces the number of API calls compared to multiple individual calls from an external system. By consolidating the logic into one Apex method, the integration can execute all lookups and creates in a single inbound API call plus one DML operation, drastically reducing API consumption while maintaining near-real-time performance.

Why the other options are wrong

  • A. Using both REST and SOAP APIs does not increase the allowed API call limit; limits are enforced across all API types in aggregate.
  • B. Inbound Messages have similar limitations to outbound API calls and Flow execution would not reduce the total API calls consumed.
  • D. InboundEmailHandlers bypass some API limits but introduce complexity and are not designed for structured data integration workflows; this approach also does not inherently solve the API limit issue.

Question 96

Which of the following variables are not transmitted in the view state? (Choose two.)

  1. Private
  2. Transient
  3. Public
  4. Static
Show answer and explanation

Correct answer: B, D. Transient; Static

View state in Visualforce pages only stores serializable instance variables. Static variables are never included in view state because they belong to the class itself, not to an instance. Transient variables are explicitly marked to be excluded from view state serialization. Private and Public variables are both instance variables and are included in view state if they are serializable.

Why the other options are wrong

  • A. Private variables are instance variables and are serialized into view state.
  • C. Public variables are instance variables and are serialized into view state.

Question 97

Which interface needs to be implemented by an Aura Component so that it may be displayed in modal dialog by clicking a button on a Lightning Record page?

  1. force:lightningQuickAction
  2. lightning:QuickAction
  3. lightning:editAction
  4. force:lightningEditAction
Show answer and explanation

Correct answer: A. force:lightningQuickAction

An Aura component must implement force:lightningQuickAction to be used as a quick action on a Lightning record page. When the action button is clicked, the component opens in a modal dialog with standard Cancel and Save controls.

Why the other options are wrong

  • B. lightning:QuickAction is not the interface name, the correct namespace is force.
  • C. lightning:editAction is not a valid Aura interface.
  • D. force:lightningEditAction is not a valid Aura interface.

Question 98

A company wants to implement a new call center process for handling customer service calls. It requires service reps to ask for the caller's account number before proceeding with the rest of their call script. Following best practices, what should a developer use to meet this requirement?

  1. Apex Trigger
  2. Process Builder
  3. Flow Builder
  4. Approvals
Show answer and explanation

Correct answer: C. Flow Builder

Flow Builder is the optimal tool for implementing guided, sequential processes like a call center script that requires collecting specific information (account number) before proceeding. Flow Builder provides a visual interface to create step-by-step workflows with decision logic and is purpose-built for user-facing guided processes. Apex Triggers operate on database events, Process Builder is limited to automated actions, and Approvals handles approval chains, none are designed for interactive guided processes.

Why the other options are wrong

  • A. Apex Triggers operate on data changes, not on guiding user interactions through a script.
  • B. Process Builder lacks the interactive capabilities needed for a guided call script with conditional logic.
  • D. Approvals is designed for approval workflows, not for executing call center scripts.

Question 99

The SOAP API __________.

  1. Is based on REST principles and is optimized for loading or deleting large sets of data. You can use it to query, queryAll, insert, update, upsert, or delete many records asynchronously by submitting batches
  2. Provides a powerful, convenient, and simple REST-based web services interface for interacting with Salesforce. Its advantages include ease of integration and development, and it's an excellent choice of technology for use with mobile applications and web projects
  3. Is used to create, retrieve, update or delete records, such as accounts, leads, and custom objects, and allows you to allows you to maintain passwords, perform searches, and much more
  4. Is used to retrieve, deploy, create, update, or delete customizations for your org. The most common use is to migrate changes from a sandbox or testing org to your production environment
Show answer and explanation

Correct answer: C. Is used to create, retrieve, update or delete records, such as accounts, leads, and custom objects, and allows you to allows you to maintain passwords, perform searches, and much more

The SOAP API is used to create, retrieve, update, and delete records such as accounts and leads, and provides additional capabilities including password maintenance, searching, and more comprehensive data manipulation operations.

Why the other options are wrong

  • A. This describes the Bulk API, which handles asynchronous batch operations.
  • B. This describes the REST API, which is designed for mobile and web applications.
  • D. This describes the Metadata API, which handles customization deployments and migrations.

Question 100

What is the transaction limit on the max execution time?

  1. 5 minutes
  2. 10 minutes
  3. 15 minutes
  4. 20 minutes
  5. There is no limit
Show answer and explanation

Correct answer: B. 10 minutes

The transaction limit on maximum execution time is 10 minutes. This represents the total time allowed for a single transaction to complete, including all Apex code execution, database operations, and other processing. Exceeding this limit results in a transaction timeout.

Why the other options are wrong

  • A. 5 minutes is half the actual maximum execution time.
  • C. 15 minutes exceeds the enforced transaction time limit.
  • D. 20 minutes is double the actual limit.
  • E. A strict 10-minute limit is enforced on transaction execution time.

100 questions in. Want the rest? The first half of the pack, free by email · The full pack

Question 101

A developer is writing code that requires making callouts to an external web service. Which scenario necessitates that the callout be made in an @future method?

  1. The callouts will be made in an Apex Trigger.
  2. The callouts will be made in an Apex Test class.
  3. The callout could take longer than 60 seconds to complete.
  4. Over 10 callouts will be made in a single transaction.
Show answer and explanation

Correct answer: A. The callouts will be made in an Apex Trigger.

Callouts cannot be made directly from Apex Triggers because triggers are part of the database transaction. The @future method is required to make callouts from triggers because it executes asynchronously outside the original transaction context, allowing the callout to proceed without blocking the transaction. This is a Salesforce governor limit constraint.

Why the other options are wrong

  • B. Callouts cannot be made in test methods at all, not because of the @future requirement, but because tests do not support actual HTTP callouts.
  • C. Callout duration limits do not require @future; long callouts are still subject to timeout limits regardless of whether @future is used.
  • D. Multiple callouts (over 10) do not require @future; the limit on callouts is enforced within a transaction, but @future is not necessary to make more than 10 callouts spread across multiple transactions.

Question 102

Which statement is true regarding the use of user input as part of a dynamic SOQL query?

  1. Free text input should not be allowed, to avoid SOQL injection
  2. The String.format() method should be used to prevent injection
  3. Quotes should be escaped to protect against SOQL injection
  4. The string should be URL encoded by the input form to prevent errors
Show answer and explanation

Correct answer: C. Quotes should be escaped to protect against SOQL injection

When user input is included in a dynamic SOQL query, single quotes must be escaped, typically with String.escapeSingleQuotes(), so the input cannot break out of the string literal and alter the query. Using bind variables is the other standard defense.

Why the other options are wrong

  • A. Free text input can be used safely if it is escaped or bound, so banning it is unnecessary.
  • B. String.format() only substitutes values into a string and does not protect against injection.
  • D. URL encoding addresses transport of data in URLs, not SOQL injection in Apex.

Question 103

A developer wants to create a Visualforce page that allows a user to search for a given account by Name. If the account is found, the account details should be populated on screen. If no account is found, an error message should be displayed to the user. How can this be accomplished? (Choose two.)

  1. Use the (apex: information) tag to display the error message
  2. Use the ApexPages.addMessage() method to add the error message
  3. Use the <apex:pageMessages> tag to display the error message
  4. Use the account.addError() method to add the error message
Show answer and explanation

Correct answer: B, C. Use the ApexPages.addMessage() method to add the error message; Use the <apex:pageMessages> tag to display the error message

ApexPages.addMessage() is the programmatic method to add custom error, warning, or info messages that are then displayed by the pageMessages component (B is correct). The <apex:pageMessages> tag is the Visualforce component that renders all messages added via ApexPages.addMessage() (C is correct). The <apex:information> tag (if it exists) is not a standard Visualforce tag for displaying messages. The account.addError() method adds field-level errors to sObject records, not page-level user messages.

Why the other options are wrong

  • A. The apex:information tag is not a standard Visualforce component for displaying error messages.
  • D. The addError() method is used to add validation errors to sObject fields, not to display page-level messages to users in this scenario.

Question 104

What are three benefits of using declarative customizations over code? (Choose three.)

  1. Declarative customizations cannot generate run time errors.
  2. Declarative customizations will automatically update with each Salesforce release.
  3. Declarative customizations do not require user testing.
  4. Declarative customizations are not subject to governor limits.
  5. Declarative customizations generally require less maintenance.
Show answer and explanation

Correct answer: B, D, E. Declarative customizations will automatically update with each Salesforce release; Declarative customizations are not subject to governor limits; Declarative customizations generally require less maintenance.

Option B is correct because declarative customizations automatically receive updates with each Salesforce release without requiring manual code updates. Option D is correct because declarative customizations are not subject to Apex governor limits, allowing for greater scalability. Option E is correct because declarative solutions generally require less maintenance than code-based solutions. Option A is incorrect because declarative customizations can still produce runtime errors. Option C is incorrect because declarative customizations still require user testing to ensure they work as intended.

Why the other options are wrong

  • A. Declarative customizations can generate runtime errors, such as configuration conflicts or validation rule failures.
  • C. Declarative customizations still require user testing to verify they meet business requirements and function correctly.

Question 105

What is the optimal syntax for adding a link to a case in a Visualforce page? (Choose two.)

  1. <apex:outputLink value="{$URLFOR($Action.Case.Open, case)}" target="blank"> {Icase.Name} </apex:outputLink>
  2. <apex:outputLink value="/{!case. Id}" target="blank"> {Icase.Name}</apex:outputLink>
  3. <apex:outputLink value="{!URLFOR($Action.Case.View,case. Id)}" target="blank">(LIE{!case. Name}</apex:outputLink>
  4. <apex:outputLink value="!viewCase(case. Id)}" target="_blank">{Icase.Name} </apex:outputLink>
Show answer and explanation

Correct answer: B, C. <apex:outputLink value="/{!case. Id}" target="blank"> {Icase.Name}</apex:outputLink>; <apex:outputLink value="{!URLFOR($Action.Case.View,case. Id)}" target="blank">(LIE{!case. Name}</apex:outputLink>

Option B uses the direct ID-based URL format '/{!case.Id}' which is a valid and simple way to create a link to a case record. Option C uses the URLFOR function with the $Action.Case.View action, which is the optimal recommended syntax that generates the correct URL regardless of Salesforce instance configuration. Both approaches work correctly for linking to case records. Option A uses Case.Open which is not a valid action, and Option D has malformed syntax with incorrect quote escaping.

Why the other options are wrong

  • A. The $Action.Case.Open action does not exist; the correct action is $Action.Case.View for viewing a case.
  • D. The syntax is malformed with incorrect quote usage and an invalid function call viewCase(); this is not valid Visualforce syntax.

Question 106

What is the most efficient way in Visualforce to show information based on data filters defined by an end-user for a large volume of data?

  1. Use the rendered condition in Visualforce to limit data based on data filters
  2. Use filter conditions in a SOQL query to limit data based on data filters
  3. Use an Apex controller to refine raw data based on data filters and store the result in a transient variable
  4. Use an Apex controller to refine raw data based on data filters and store the result in a static variable
Show answer and explanation

Correct answer: B. Use filter conditions in a SOQL query to limit data based on data filters

The most efficient approach for handling large volumes of data is to filter at the database level using SOQL query conditions. This reduces the dataset returned to only the records matching user-defined filters, minimizing memory consumption and processing overhead. Using rendered conditions in Visualforce still loads all data into memory before filtering. Storing results in transient or static variables requires loading unnecessary data into memory. SOQL filtering ensures only relevant data is retrieved from the database, making it optimal for large datasets.

Why the other options are wrong

  • A. Rendered conditions filter on the page after all data is loaded, wasting memory and processing resources on unnecessary data.
  • C. Storing unfiltered data in a transient variable still requires loading the entire large dataset into memory before filtering.
  • D. Static variables persist across requests and are shared; using them for filtered results causes memory and concurrency issues.

That was 106 of 424.

The full Salesforce Platform Developer II pack has all 424 questions, each with the answer, the explanation and why the other options are wrong, plus a questions-only copy for timed runs. US$39, paid once, with free monthly updates and a pass-or-your-money-back guarantee.

Get the full pack

Not ready yet? Get the first 197 free as one PDF by email. Get the Half Pack →