Font size
WorksheetsSalesforce Platform Developer II
Total questions: 145
Worksheet time: 1hrs 21mins
A company has a custm object, Order__c, that has a required, unique external ID field called Order_Number__c.
Which statement should be used to perform the DML necessary to insert new records and update existing records in a list of Order__c records using the external ID field?
upsert orders Order_Number__c;
upsert orders;
merge orders;
merge orders Order_Number__c
An Apex class does not achieve expected code coverage. The testSetup method explicitly calls a method in the Apex class.
How can the developer generate the code coverage?
Add $testVisible to the method in the class the developer is testing.
Verify the user has permissions passing a user into the System.runAs().
Call the Apex class method from a testMethod instead of the testSetup method.
Use system.assert() in testSetup to verify the values are being returned
Which method should be used to convert a Date to a String in the current user's locale?
Date.parse
Date.format
String.format
String.valueOf
A developer is tasked with creating a Lightning web component that allows users to create a Case for a selected product, directly from a custom Lightning page. The input fields in the component are displayed in a non-linear fashion on top of an image of the product to help the user better understand the meaning of the fields.
Which two components should a developer use to implement the creation of the Case from the Lightning web component?
Choose 2 answers
lightning-record-edit-form
lightning-input
lightning-record-form
lightning-input-field
Ursa Major Solar has a custom object, ServiceJob__c, with an optional Lookup field to Account called Partner_Service_Provider__c.
The TotalJobs__c field on Account tracks the total number of ServiceJob__c records to which a partner service provider Account is related.
What is the most efficient way to ensure that the Total_Jobs__c field is kept up to date?
Create a record-triggered flow on Service_Job_c.
Change TotalJobs__c to a roll-up summary field.
Create a schedule-triggered flow on Service_Job__c.
Create an Apex trigger on ServiceJob__c.
What are three reason that a developer should write Jest tests for Lightning web component?
Choose 3 answers
To verify that events fire when expected
To test basic user interaction
To verify the DOM output of a component
To test how multiple components work together
To test a component's non-public properties
As part of a custom development, a developer creates a Lightning component to show how a particular opportunity progresses over time. The component must display the date stamp when any of the following fields change:
- Amount, Probability, Stage, or Close Date
How should the developer access the data the must be displayed?
Create a custom date field on Opportunity for each field to track the previous date and execute a SOQL query for date field.
Execute a SOQL query for Amount, Probability, Stage, and Close Date on the OpportunityHistory object.
Subscribe to the OpportunityHistory Change Data Capture event in the Lightning component.
Subscribe to the Opportunity Change Data Capture event in the Lightning component
A developer is inserting, updating, and deleting multiple lists of records in a single transaction and wants to ensure that any error prevents all execution.
How should the developer implement error exception handling in their code to handle this?
Use Database methods to obtain lists of Database.SaveResults.
Use Database.setSavepoint() and Database.rollBack() with a try-catch statement.
Use a try-catch statement and handle DML cleanup in the catch statement.
Use a try-catch and use sObject.addError() on any failures.
Which annotation should a developer use on an Apex method to make it available to be wired to a property in a Lightning web component?
@RemoteAction
@AuraEnabled(cacheable=true)
@RemoteAction(cacheable=true)
@AuraEnabled
Universal Containers uses Big Objects to store almost a billion customer transactions called Customer_Transaction__b.
These are the fields on the Custom_Transaction__b:
The following fields have been identified as Index Fields for the Customer_Transaction__b object: Account__c, Program__c, and Transaction_Date__c.
Which SOQL query is valid on the Customer_Transaction__c Big Object?
Given the following containment hierarchy:
What is the correct way to communicate the new value of a property named "passthrough" to my-parent-component if the property is defined within my-child-component?
A lead developer for a Salesforce organization needs to develop a page-centric application that allows the user to interact with multiple objects related to a Contact. The application needs to implement a third-party JavaScript framework such as Angular, and must be made available in both Classic and Lightning Experience.
Given these requirements, what is the recommended solution to develop the application?
Lightning Experience Builder
Aura Components
Visualforce
Lightning Web Components
Users upload .csv files in an external system to create account and contact records in Salesforce. Up to 200 records can be created at a time. The users need to wait for a response from Salesforce in the external system, but the data does not need to synchronize between the two systems.
Based on these requirements, which method should a developer use to create the records in Salesforce?
REST API request using composite/batch/
REST API request using composite/tree/
Apex web services
Bulk API 2.0
Consider the controller code below that is called from an Aura component and returns data wrapped in a class.
The developer verified that the queries return a single record each and there is error handling in the Aura component, but the component is not getting anything back when calling the controller getSomeData().
What is wrong?
The member's Name and Option should not be declared public.
The member's Name and Option of the class MyDataWrapper should be annotated with @AuraEnabled also.
Instances of Apex classes, such as MyDataWrapper, cannot be returned to a Lightning component.
The member's Name and Option should not have getter and setter.
Consider the following code snippet:
When the component is deployed, an error is reported.
Which two changes should the developer implement in the code to ensure the component deploys successfully?
Choose 2 answers
import getOrders from '@salesforce/apex/OrderController.getAvailableOrders';
import { LightningElement, api } from 'lwc';
import getOrders from '@salesforce/apex/c.OrderController.getAvailableOrders';
import { LightningElement, wire } from 'lwc';
There are user complaints about slow render times of a custom data table within a Visualforce page that loads thousands of Account records at once.
What can a developer do to help alleviate such issues?
Use JavaScript remoting to query the records.
Upload a third-party data table library as a static resource.
Use the standard Account List controller and implement pagination.
Use the transient keyword in the Apex code when querying the Account records.
Salesforce users consistently receive a "Maximum trigger depth exceeded" error when saving an Account.
How can a developer fix this error?
Split the trigger logic into two separate triggers.
Use a helper class to set a Boolean to TRUE the first time a trigger is fired, and then modify the trigger to only fire when the Boolean is FALSE.
Convert the trigger to use the @future annotation, and chain any subsequent trigger invocations to the Account object.
Modify the trigger to use the isMultiThread=true annotation.
A corporation has many different Salesforce orgs, with some different objects and some common objects, and wants to build a single Java application that can create, retrieve, and update common object records in all of the different orgs.
Which method of integration should the application use?
SOAP API with the Enterprise WSDL
SOAP API with the Partner WSDL
Apex REST Web Service
Metadata API
A developer wrote a trigger on Opportunity that will update a custom Last Sold Date field on the Opportunity's Account whenever an Opportunity is closed. In the test class for the trigger, the assertion to validate the Last Sold Date field fails.
What might be causing the failed assertion?
The test class is not using System.runAs() to run tests as a Salesforce administrator.
The test class has not defined an Account owner when inserting the test data.
The test class has not implemented seeAllData=true in the test method.
The test class has not re-queried the Account record after updating the Opportunity.
A developer created the following test class to provide the proper code coverage for the snippet above:
However, when the test runs, no data is returned and the assertion fails.
Which edit should the developer make to ensure the test class runs successfully?
Implement the seeAllData=true attribute in the @IsTest annotation.
Enclose the method call within Test.startTest() and Test.stopTest().
Implement the setFixedSearchResults method in the test class.
Implement the without sharing keyword in the searchFeature Apex class/
What is a benefit of using a WSDL with Apex?
Enables the user to not pass a Session ID where it is not necessary
Reduces the number of callouts to third-party web services
Allows for web-services to be tested and achieve code coverage
Allows for classes to be generated from WSDL and imported into Salesforce
A developer needs to store variables to control the style and behavior of a Lightning Web Component.
Which feature should be used to ensure that the variables are testable in both Production and all Sandboxes?
Custom variable
Custom object
Custom metadata
Custom setting
A company has an Apex process that makes multiple extensive database operations and web service callouts. The database processes and web services can take a long time to run and must be run sequentially.
How should the developer write this Apex code without running into governor limits and system limitations?
Use Limits class to stop entire process once governor limits are reached.
Use Apex Scheduler to schedule each process.
Use Queueable Apex to chain the jobs to run sequentially.
Use multiple @future methods for each process and callout.
A business currently has a process to manually upload orders from its external Order Management System (OMS) into Salesforce.
This is a labor intensive process since accounts must be exported out of Salesforce to get the IDs. The upload file must be updated with the correct account IDs to related the orders to the corresponding accounts.
Which two recommendations should make this process more efficient?
Choose 2 answers
Ensure the data in the file is sorted by the order ID.
Use the upsert wizard in the Data Loader to import the data.
Identify unique fields on Order and Account and set them as External IDs.
Use the insert wizard in the Data Loader to import the data.
A company uses their own custom-built enterprise resource planning (ERP) system to handle order management. The company wants Sales Reps to know the status of orders so that if a customer calls to ask about their shipment, the Sales Rep can advise the customer about the order's status and tracking number if it has shipped.
Which two methods can make this ERP order data visible in Salesforce?
Choose 2 answers
Use Salesforce Connect to view real-time Order data in the ERP system.
Have the ERP system push the data into Salesforce using SOAP API.
Ensure real-time order data is in Salesforce using the Streaming API.
Write a cron job in Salesforce to poll the ERP system for order updates.
A developer wrote an Apex method that makes an HTTP callout to an external system to get specialized data when a button is clicked from a custom Lightning web component on the Account record page.
Recently, users have complained that it takes longer than desired for the data to appear on the page after clicking the button.
What should the developer use to troubleshoot this issue?
Lightning Inspector
Developer Console
Salesforce CLI
Event Logs
Consider the following code snippet:
Which two best practices should the developer implement to optimize this code?
Choose 2 answers
Use a collection for the DML statement.
Query the Pricing_Structure__c records outside of the loop.
Change the trigger context to after update, after insert.
Remove the DML statement.
A developer is creating a Lightning web component that displays a list of records in a lightning-datatable. After saving a new record to the database, the list is not updating,
What should the developer change in the code above for this to happen?
Add the @track decorator to the data variable.
Create a new variable to store the result and annotate it with @track.
Call refreshApex() on this.data.
Create a variable to store the result and call refreshApex().
A developer is experiencing issues with a Lightning web component. The component must surface information about Opportunities owned by the currently logged-in user.
When the component is rendered, the following message is displayed: "Error retrieving data".
Which modification should be implemented to the Apex class to overcome the issue?
Use ther Continuation=true attribute in the Apex method.
Edit the code to use the without sharing keyword in the Apex class.
Use the Cacheable=true attribute in the Apex method.
Ensure the OWD for the Opportunity object is Public.
A developer used custom settings to store some configuration data that changes occasionally. However, tests are now failing in some of the sandboxes that were recently refreshed.
What should be done to eliminate the issue going forward?
Set the setting type on the custom setting to Hierarchy.
Set the setting type on the custom setting to List.
Replace custom settings with static resources.
Replace custom settings with custom metadata.
A developer wishes to improve runtime performance of Apex calls by caching results on the client.
What is the most efficient way to implement this?
Set a cookie in the browser for use upon return to the page.
Decorate the server-side method with @AuraEnabled(storable=true)
Decorate the server-side method with @AuraEnabled(cacheable=true)
Call the setStorable() method on the action in the JavaScript client-side code.
A developer wrote the following method to find all the test accounts in the org:
However, the test method below fails.
What should be used to fix this failing test?
Test.loadData to set up expected data
Test.fixedSearchResults() method to set up expected data
@isTest(SeeAllData=true) to access org data for the test
@testSetup method to setup expected data
Consider the following code snippet:
Which two steps should the developer take to add flexibility to change the endpoint and credentials without needing to modify the code?
Choose 2 answers
Create a Named Credential, endPoint_NC, to store the endpoint and credentials.
Strore the URL of the endpoint in a custom Label named endpointURL.
Use req.setEndpoint('callout:endpoint_NC'); without the callout request.
Use req.setEndpoint(Label.endPointURL);.
Which tag should a developer use to display different text while an <apex:commandButton> is processing an action?
<apex:actionPoller>
<apex:actionStatus>
<apex:actionSupport>
<apex:pageMessages>
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?
Apex Batch job that counts the number of Opportunity records
COUNT() SOQL aggregate query on the Opportunity object
SUM() SOQL aggregate query on the Opportunity object
SOQL for loop that counts the number of Opportunity records.
What is the best practice to initialize a Visualforce page in a test class?
Use Test.setCurrentPage(Page.MyTestPage);
Use Test.currentPage.getParameters.put(MyTestPage);
Use controller.currentPage.setPage(MyTestPage);
Use Test.setCurrentPage.MyTestPage;
Just prior to a new deployment the Salesforce administrator, who configured a new order fulfillment process feature in a developer sandbox, suddenly left the company.
As part of the UAT cycle, the users had fully tested all of the changes in the sandbox and signed off on them; making the Order fulfillment feature ready for its go-live in the production environment.
Unfortunately although a Change Set was started, it was not completed by the former administrator. A developer is brought in to finish the deployment.
What should a developer do to identify the configuration changes that need to be moved into production?
Leverage the Setup Audit Trail to review the changes made by the departed Administrator and identify which changes should be added to the Change Set.
In Salesforce setup, look at the last modified date for every object to determine which should be added to the Change Set.
Set up Continuous Integration and a Git repository to automatically merge all changes from the sandbox metadata with the production metadata.
Use the Metadata API and a supported development IDE to push all of the configuration from the sandbox into production to ensure no changes are lost.
As part of point-to-point integration, a developer must call an external web service which, due to high demand, takes a long time to provide a response. As part of the request, the developer must collect key inputs from the end user before making the callout.
Which two elements should the developer use to implement these business requirements?
Choose 2 answers
Screen Flow
Lightning web component
Process Builder
Apex method that returns a Continuation object
Universal Containers requested the addition of a third-party Map widget to an existing Lightning web component.
Which two actions should the developer take to implement this requirement?
Choose 2 answers
Import the third-party JavaScript module directly into the component.
Use a content distribution network and include <script> </script> tags in the component.
Import loadScript from lightning/platformResourceLoader.
Upload the third-party JavaScript library as a static resource that imports into the component.
A company has a custom object, Order__c, that has a custom picklist field, Status__c, with values of 'New,' 'In Progress,' or 'Fulfilled' and a lookup field, Contact__c, to Contact.
Which SOQL query will return a unique list of all the Contact records that have no 'Fulfilled' Orders?
A developer created an Opportunity trigger that updates the account rating when an associated opportunity is considered high value. Currently criteria for an opportunity to be considered high value is an amount greater than or equal to $1,000,000. However, this criteria value can change over time.
There is a new requirement to also display high value opportunities in a Lightning web component.
Which two actions should the developer take to prevent the business logic that obtains the high value opportunities from being repeated in more than one place?
Choose 2 answers
Use custom metadata to hold the high value amount.
Call the trigger from the Lightning web component.
Leave the business logic code inside the trigger for efficiency.
Create a helper class that fetches the high value opportunities.
A lightning web component exists in the system and displays information about the record in context as a modal. Salesforce administrators need to use this component within the Lightning App Builder.
Which two settings should the developer configure within the xml resource file?
Choose 2 answers
Set the IsVisible attribute to true.
Specify the target to be lightning_RecordPage.
Specify the target to be lightning__AppPage.
Set the IsExposed attribute to true.
Refer to the test method below:
The test method calls a web service that updates an external system with Account information and sets the Account's Integration_Update__c checkbox to True when it completes.
The test fails to execute and exists with an error: "Method defined as TestMethod do not support Web service callouts."
What is the optimal way to fix this?
Add Test.startTest() before and Test.stopTest() after Callout.Util.sendAccountUpdate.
Add Test.startTest() and Test.setMock before and Test.stopTest() after CalloutUtil.sendAccountUpdate.
Add Test.startTest() before and Test.setMock and Test.stopTest() after CalloutUtil.sendAccountUpdate.
Add if (!Test.isRunningTest()) around CalloutUtil.sendAccountUpdate.
A Salesforce org has more than 50,000 contacts. A new business process requires a calculation that aggregates data from all of these contact records. This calculation needs to run once a day after business hours.
Which two steps should a developer take to accomplish this?
Choose 2 answers
Use the @future annotation on the method that performs the aggregate calculation.
Implement the Schedulable interface in the class that contains the aggregate calculation method.
Use the @readOnly annotation on the method that performs the aggregate calculation.
Implement the Queueable interface in the class that contains the aggregate calculation method.
A Visualforce page needs to make a callout to get billing information and tax information from two different REST endpoints. The information needs to be displayed to the user at the same time and the return value of the billing information contains the input for the tax information callout. Each endpoint might take up to two minutes to process.
How should a developer implement the callouts?
A Continuation for the billing callout and an HTTP REST callout for the tax callout
A Continuation for both the billing callout and the tax callout
An HTTP REST callout for the billing callout and a Continuation for the tax callout
An HTTP REST callout for both the billing callout and the tax callout
Given the following code:
Assuming there were 10 Contacts and five Accounts created today, what is the expected result?
System.QueryException: List has more than one row for Assignment on Account
System.LimitException: Too many SOQL Queries on Contact
System.QueryException: Too many DML Statement errors on Contact
System.LimitException: Too many SOQL Queries and Account
A company uses Salesforce to sell products to customers. They also have an external product information management (PIM) system that is the system of records for products.
A developer received these requirements:
- Whenever a product is created or updated in the PIM, a product must be created or updated as a Product2 record in Salesforce and a PricebookEntry record must be created or updated automatically by Salesforce.
- The PricebookEntry should be created in a Pricebook2 that is specified in a custom setting.
What should the developer use to satisfy these requirements?
Apex REST
Event Monitoring
Invocable Action
SObject Tree
A developer wants to write a generic Apex method that will compare the Salesforce Name field between two object records. For example, to compare the Name field of an Account and an Opportunity; or the Name of an Account and a Contact.
Assuming the Name field exists, how should the developer do this?
Cast each object into an sObject and use sObject.get('Name') to compare the Name fields.
Invoke a Schema.describe() function to compare the values of each Name field.
Use the Salesforce Metadata API to extract the value of each object and compare the Name fields.
Use a String.replace() method to parse the contents of each Name field and then compare the results.
There is an Apex controller and a Visualforce page in an org that displays records with a custom filter consisting of a combination of picklist values selected by the user.
The page takes too long to display results for some of the input combinations, while for other input choices it throws the exception, "Maximum view state size limit exceeded".
What step should the developer take to resolve this issue?
Adjust any code that filters by picklist values since they are not indexed.
Split the layout to filter records in one Visualforce page and display the list of records in a second page using the same Apex controller.
Remove instances of the transient keyword from the Apex controller to avoid the view state error.
Use a StandardSetController or SOQL LIMIT in the Apex controller to limit the number of records displayed at a time.
The Salesforce admin at Cloud Kicks created a custom object called Region__c to store all postal zip codes in the United States and the Cloud Kicks sales region the zip code belongs to.
Cloud Kicks wants a trigger on the Lead to populate the Region based on the Lead's zip code.
Which code segment is the most efficient way to fulfill this request?
Which statement is considered a best practice for writing bulk safe Apex triggers?
Add LIMIT 50000 to every SOQL statement.
Instead of DML statements, use the Database methods with allOrNone set to false.
Add records to collection and perform DML operations against these collections.
Perform all DML operations from within a future method.
A company has a custom component that allows users to search for records of a certain object type by invoking an Apex Controller that returns a list of results based on the user's input. When the seach is completed, a searchComplete event is fired, with the results put in a results attribute of the event. The component is designed to be used within other components and may appear on a single page more than once.
What is the optimal code that should be added to fire the event when the search has completed?
Consider the following code snippet:
The Apex method is executed in an environment with a large data volume count for Accounts, and the query is performing poorly.
Which technique should the developer implement to ensure the query performs optimally, while preserving the entire result set?
Annotate a method with the @Future annotation.
Create a formula field to combine the CreatedDate and RecordType value, then filter based on the formula.
Use the Database.queryLocator method to retrieve the accounts.
Break down the query into two individual queries and join the two result sets.
A developer is creating a page in App Builder that will be used in the Salesforce mobile app.
Which two practices should the developer follow to ensure the page operates with optimal performance?
Choose 2 answers
Limit five visible components on the page.
Limit 25 fields on the record detail page.
Limit the number of Tabs and Accordion components.
Analyze the page with Performance Analysis for App Builder.
A company has code to update a Request and Request Lines and make a callout to their external ERP system's REST endpoint with the updated records.
The CalloutUtil.makeRestCallout fails with a 'You have uncommitted work pending. Please commit or rollback before calling out' error.
What should be done to address the problem?
Move the CalloutUtil.makeRestCallout method call below the catch block.
Change the CalloutUtil.makeRestCallout to an @future method.
Remove the Database.setSavePoint and Database.rollback.
Change the CalloutUtil.makeRestCallout to an @InvocableMethod method.
Universal Containers implements a private sharing model for the Convention_Attendee__c custom object. As part of a new quality assurance effort, the company create an Event_Reviewer__c user lookup field on the object. Management wants the event viewer to automatically gain Read/Write access to every record they are assigned to.
What is the best approach to ensure the assigned reviewer obtains Read/Write access to the record?
Create criteria-based sharing rules on the Convention Attendee custom object to share the records with the Event Reviewers.
Create a before insert trigger on the Convention Attendee custom object, and use Apex Sharing Reasons and Apex Managed Sharing.
Create an after insert trigger on the Convention Attendee custom object, and use Apex Sharing Reasons and Apex Managed Sharing.
Create a criteria-based sharing rule on the Convention Attendee custom object to share the records with a group of Event Reviewers.
A page throws an 'Attempt to dereference a null object' error for a Contact.
What change in the controller will fix the error?
Change the getter's signature to be static Contact.
Change the setter's signature to return a Contact.
Use a condition in the getter to return a new Contact if it is null.
Declare a static final Contact at the top of the controller.
As part of a custom interface, a developer team creates various new Lightning web component. Each of the components handles errors using toast messages. When the development is complete, all the components are added to the same Lightning page.
During acceptance testing, users complain about the long chain of toast messages that display when errors occur loading the components.
Which two techniques should the developer implement to improve the user experience?
Choose 2 answer
Use a <template> tag to display in-place error messages.
Use a Lightning web component to aggregate and display all errors.
Use the window.alert() method to display the error messages.
Use public properties on each component to display the error messages.
Refer to the component code and requirements below:
Requirements:
1. For mobile devices, the information should display in three rows.
2. For desktops and tables, the information should display in a single row.
Requirement 2 is not displaying as desired.
Which option has the correct component code to meet the requirements for desktops and and tablets?
How should a developer assert that a trigger with an asynchronous process has successfully run?
Create all test data, use @future in the test class, then perform assertions.
Create all test data in the test class, invoke Test.startTest() and Test.stopTest() and then perform assertions.
Insert records into Salesforce, use seeAllData=true, then perform assertions.
Create all test data in the test class, use System.runAs() to invoke the trigger, then perform assertions.
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.
Which two statements are true regarding these issues and resolution?
Choose 2 answers
The administrator are deploying their own Change Sets, thus deleting each other's fields from the objects in production.
A sandbox should be created to use as a unified testing environment instead of deploying Change Sets directly to production.
Page Layouts should never be deployed via Change Sets, as this cause Field-Level Security to be reset and fields to disappear.
The administrator are deploying their own Change Sets over each other, thus replacing entire Page Layouts in production.
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?
Write an after update trigger on Account for the Is Primary logic and a before update trigger on Contact for the last name logic.
Write a single trigger on Contact for both after update and before update and callout to helper classes to handle each set of logic.
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.
Write a Validation Rule on the Contact for the Is Primary logic and a before update trigger on Contact for the last name logic.
Universal Containers needs to integrate with a Heroku service that resizes product images submitted by users.
What are two alternatives to implement integration and protect against malicious calls to the Heroku app's endpoint?
Choose 2 answers
Create a trigger that uses an @future Apex HTTP callout passing JSON serialized data; therefore the Heroku app can automatically reply back to the callout with the resized images in Salesforce.
Create a flow with an outbound message action allowing the Heroku app to automatically store the resized images in Salesforce.
Use Heroku Connect as an intermediary service allowing the Heroku app to automatically store the resized images in Salesforce.
Create a trigger that uses an @future Apex HTTP callout passing JSON serialized data and some form of pre-shared secret-key, so that the Heroku app can authenticate requests and store the resized images in Salesforce.
Refer to the code snippet below:
As part of an integration development effort, a developer is tasked to create an Apex method that solely relies on the use of foreign identifiers in order to relate new contact records to existing Accounts in Salesforce. The account object contains a field marked as an external ID, the API Name of this field is Legacy_Id__c.
What is the most efficient way to instantiate the parentAccount variable on line 02 to ensure the newly created contact is properly related to the Account?
After a platform event is defined in a Salesforce org, events can be published via which mechanism?
Internal Apps can use outbound messages.
Internal Apps can use entitlement processes.
External Apps require the standard Streaming API.
External Apps use an API to publish event messages.
Refer to the code snippet below:
When a Lightning web component is rendered, a list of opportunities that match certain criteria should be retrieved from the database and displayed to the end-user/
Which three considerations must the developer implement to make the fetchOpportunities method available within the Lightning web component?
Choose 3 answers
The method must be annotated with the @InvocableMethod annotation.
The method must be annotated with the @AuraEnabled annotation.
The method must specify the (cacheable=true) attribute.
The method must specify the (continuation=true) attribute.
The method cannot mutate the result set retrieved from the database.
A developer is asked to develop a new AppExchange application. A feature of the program creates Survey records when a Case reaches a certain stage and is of a certain Record Type. This feature needs to be configurable, as different Salesforce Instances require Surveys at different times. Additionally, the out-of-the-box AppExchange app needs to come with a set of best practice settings that apply to most customers.
What should the developer use to store and package the custom configuration settings for the app?
Custom metadata
Custom objects
Custom labels
Custom settings
The Contact object in an org is configured with workflow rules that trigger field updates. The fields are not updating, even though the end user expects them to. The developer creates a debug log to troubleshoot the problem.
What should the developer specify in the debug log to see the values of the workflow rule conditions and debug the problem?
ERROR level for the Database log category
INFO level for the Workflow log category
INFO level for the Database log category
ERROR level for the Workflow log category
Which two scenarios require an Apex method to be called imperatively from a Lightning web component?
Choose 2 answers
Calling a method that makes a web service callout
Calling a method that is not annotated with cacheable=true
Calling a method with the click of a button
Calling a method that is external to the main controller for the Lightning web component
A developer writes a Lightning web component that displays a dropdown list of all custom objects in the org from which a user will select. An Apex method prepares and returns data to the component.
What should the developer do to determine which objects to include in the response?
Check the isCustom() value on the sObject describe result.
Use the getCustomObjects() method from the Schema class.
Check the getObjectType() value for 'Custom' or 'Standard' on the sObject describe result.
Import the list of all custom objects from @salesforce/schema.
A developer is asked to find a way to store secret data with an ability to specify which profiles and users can access which secrets.
What should be used to store this data?
System.Cookie class
Static resources
Custom settings
Custom metadata
Which use case can be performed only by using asynchronous Apex?
Updating a record after the completion of an insert
Scheduling a batch process to complete in the future
Processing high volumes of records
Calling a web service from an Apex trigger
A developer notices the execution of all the test methods in a class takes a long time to run, due to the initial setup of all the test data that is needed to perform the tests.
What should the developer do to speed up test execution?
Ensure proper usage of test data factory in all test methods.
Define a method that creates test data and annotate with @createData.
Define a method that creates test data and annotate with @testSetup.
Reduce the amount of test methods in the class.
A company has a native iOS order placement app 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?
Apex REST web service
Apex REST callout
Apex SOAP callout
Apex SOAP web service
A developer is asked to create a Lightning web component that will be invoked via a button on a record page. The component must be displayed in a modal dialog.
Which three steps should the developer take to achieve this?
Choose 3 answers
In targets, add lightning__RecordAction as a target.
Set actionType to ScreenAction.
Add a targetConfig and set targets to lightning__RecordAction.
Set eventType to Action.
In targetConfigs, add lightning__AppPage as a target.
Consider the Apex class below that defines a RemoteAction used on a Visualforce search page.
Which code snippet will assert that the remote action returned the correct Account?
Consider the following Apex method that uses the Opportunity object.
In a previous data audit, it was determined that close to 5 million Opportunity records are stored within the Salesforce environment. The organization-wide defaults for the object are set to Public Read-Only and most opportunities are related to an external case.
The method is called from a Lightning web component. Some end users do not provide a caseId value and experience low performance while running the query.
Which two techniques should the developer implement to avoid low performance queries from executing?
Choose 2 answers
Implement the with sharing keyword on the Apex class.
Use SOSL instead of SOQL queries to perform text-based searches.
Implement a LIMIT clause within the SOQL query to restrict the result set.
Ensure the user-provided input is not null before executing the SOQL query.
A developer created a JavaScript library that simplifies the development of repetitive tasks and features and uploaded the library as a static resource called jsUtils in Salesforce. Another developer is coding a new Lightning web component (LWC) and wants to leverage the library.
Which statement properly loads the static resource within the LWC?
import {jsUtilities} from '@salesforce/resourceUrl/jsUtils';
<lightning-require scripts="{!$Resource.jsUtils}">
const jsUtility - $A.get('$Resource.jsUtils');
import jsUtilities from '@salesforce/resourceUrl/jsUtils';
A developer implemented a custom data table in a Lightning web component with filter functionality. However, users are submitting support tickets about the long load times when the filters are changed. The component uses an Apex method that is called to query for records based on the selected filters.
What should the developer do to improve performance of the component?
Use a selective SOQL query with a custom index.
Use setStorable() in the Apex method to store the response in the client-side cache.
Use SOSL to query the record on filter change.
Return all records into a list when the component is created and filter the array in JavaScript.
Consider the following code snippet:
Which governor limit is likely to be exceeded when the trigger runs within a scope of 200 newly inserted accounts?
Total number of records processed as a result of DML
Total number of SOSL queries issued
Total number of DML statements issued
Total number of SOQL queries issued
A company uses an external system to manage its custom account territory assignments. Every quarter, millions of Accounts may be updates 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?
Bulk API
SAOP API
Composite REST API
Apex REST Web Service
A developer wrote a class named AccountHistoryManager that relies on field history tracking. The class has a static method called getAccountHistory that takes in an Account as parameter and returns a list of associated AccountHistory object records.
The following test fails:
What should be done to make this test pass?
Use @isTest(SeeAllData=true) to see historical data from the org and query for AccountHistory records.
Use Test.isRunningTest() in getAccountHistory() to conditionally return fake AccountHistory records.
The test method should be deleted since this code cannot be tested.
Create AccountHistory records manually in the test setup and write a query to get theme.
A developer is building a Lightning web component that retrieves data from Salesforce and assigns it to the record property.
What must be done in the component to get the data from Salesforce?
Add the following code above record;
@api(getRecord, { recordId: '$recordId', fields: '$fields' })
Add the following code above record;
@wire(getRecord, { recordId: '$recordId', fields: '$fields' })
Add the following code above record;
@wire(getRecord, { recordId: '$recordId' })
Get the fields in renderedCallback() and assign them to record.
Add the following code above record;
@api(getRecord, { recordId: '$recordId' })
Get the fields in renderedCallback() and assign them to record.
Assuming the CreateOneAccount class creates one account and implements Queueable interface, which systax properly tests the Apex code?
A developer created and tested a Visualforce page in their developer sandbox, but now receives reports that user encounter view state errors when using it in production.
What should the developer ensure to correct these errors?
Ensure variables are marked as transient.
Ensure profiles have access to the Visualforce page.
Ensure properties are marked as private.
Ensure queries do not exceed governor limits.
Given a list of Opportunity records named opportunityList, which code snippet is best for querying all Contacts of the Opportunity's Account?
A developer is developing a reusable Aura component that will reside on an sObject Lightning page with the following HTML snippet:
How can the component's controller get the context of the Lightning page that the sObject is on without requiring additional test coverage?
Set the sObject type as a component attribute.
Use the getSObjectType() method in an Apex class.
Add force:hasSObjectName to the implements attribute.
Create a design attribute and configure via App Builder
What should a developer use to query all Account fields for the Acme account in their sandbox?
SELECT FIELDS FROM Account WHERE Name = 'Acme' LIMIT 1
SELECT ALL FROM Account WHERE Name = 'Acme' LIMIT 1
SELECT * FROM Account WHERE Name = 'Acme' LIMIT 1
SELECT FIELDS(ALL) FROM Account WHERE Name = 'Acme' LIMIT 1
Consider the following queries. For these queries, assume that there are more than 200,000 Account records. There records include soft-deleted records; that is, delete records that are still in the Recycle Bin. Note that there are two fields that are marked as External Id on the Account. These fields are Customer_Number__c and ERP_Key__c.
Which two queries are optimized for large data volumes?
Choose 2 answers
SELECT Id FROM Account WHERE Name != '' AND IsDeleted = false
SELECT Id FROM Account WHERE Id IN :aListVariable
SELECT Id FROM Account WHERE Name != '' AND Customer_Number__c = 'ValueA'
SELECT Id FROM Account WHERE Name != NULL
A business requires that every parent record must have a child record. A developer writes an Apex method with two DML statements to insert a parent record and a child record.
A validation rule blocks child records from being created. The method uses a try/catch block to handle DML exception.
What should the developer do to ensure the parent always has a child record?
Use Database.insert() and set the allOrNone parameter to true.
Set a database savepoint to rollback if there are errors.
Delete the parent record in the catch statement when an error occurs on the child record DML operation.
Use addError() on the parent record if an error occurs on the child record.
The following code segment is called from a trigger handler class from the Opportunity trigger:
Which two changes should improve this code and make it more efficient?
Choose 2 answers
Use Trigger.old instead of Trigger.new.
Move the business logic inside the Opportunity trigger.
Move the DML outside of the for loop.
Move the SOQL to fetch the account record outside of the for loop.
A developer is writing a Jest test for a Lightning web component that conditionally displays child components based on a user's checkbox selections.
What should the developer do to properly test that the correct components display and hide for each scenario?
Reset the DOM after each test with the afterEach() method.
Create a new jsdom instance for each test.
Create a new describe block for each test.
Add a teardown block to reset the DOM after each test.
Universal Containers (UC) wants to develop a customer community to help their customers log issues with their containers. The community needs to function for their German- and Spanish-speaking customers also. US heard that it's easy to create an international community using Salesforce, and hired a developer to build out the site.
What should the developer use to ensure the site is multilingual?
Use custom labels to ensure custom messages are translated properly.
Use custom metadata to translate custom picklist values.
Use custom objects to translate custom picklist values.
Use custom settings to ensure custom messages are translated properly.
A developer wrote a test class that successfully asserts a trigger on Account. It fires and updates data correctly in a sandbox environment.
A Salesforce admin with a custom profiles attempts to deploy this trigger via a change set into the production environment, but the test class fails with an insufficient privileges error.
What should a developer do to fix the problem?
Add System.runAs() to the test class to execute the trigger as a user with the correct object permissions.
Verify that Test.startTest() is not inside a for loop in the test class.
Configure the production environment to enable "Run All Tests as Admin User."
Add seeAllData=true to the test class to work within the sharing model for the production environment.
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?
Salesforce Lightning Inspector Storage Tab
Salesforce Lightning Inspector Transactions Tab
Salesforce Lightning Inspector Event Log Tab
Salesforce Lightning Inspector Actions Tab
An Aura component has a section that displays some information about an Account and it works well on the desktop, but users have to scroll horizontally to see the description field output on their mobile devices and tablets.
How should a developer change the component to be responsive for mobile and table devices?
A developer created a class that implements Queueable Interface, as follows:
As part of the deployment process, the developer is asked to create a corresponding test class.
Which two actions should the developer take to successfully execute the test class?
Choose 2 answers
Implement Test.isRunningTest() to prevent chaining jobs during test execution.
Implement seeAllData=true to ensure the Queueable job is able to run in bulk mode.
Ensure the running user of the test class has, at least, the View All permission on the Order object.
Enclose System.enqueueJob(new OrderQueueableJob()) within Test.startTest() and Test.stopTest().
Universal Containers decided to use Salesforce to manage a new hire interview process. A custom object called Candidate was created with organization-wide defaults set to Private. A lookup on the Candidate object sets an employee as an Interviewer.
What should be used to automatically give Read access to the record when the lookup field is set to the Interviewer user?
The record can be shared using a permission set.
The record cannot be shared with the current setup.
The record can be shared using a sharing rule.
The record can be shared using an Apex class.
A developer created a Lightning web component for the Account record page that displays the five most recently contacted Contacts for an Account. The Apex method, getRecentContacts, returns a list of Contacts and will be wired to a property in the component.
Which two lines must change in the above code to make the Apex method able to be wired?
Choose 2 answers
Add @AuraEnabled(cacheable=true) to line 03.
Add public to line 04.
Remove private from line 09.
Add @AuraEnabled(cacheable=true) to line 08.
What is the optimal technique a developer should use to programmatically retrieve Global Picklist options in a test method?
Perform a callout to the Metadata API.
Perform a SOQL Query.
Use a static resource.
Use the Schema namespace.
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 is the optimal approach to satisfy this requirement?
Approvals
Apex trigger
Einstein Next Best Action
Flow Builder
For compliance purpose, a company is required to track long-term product usage in their org. The information that they need to log will be collected from more than one object and, over time, they predict they will have hundreds of millions of records.
What should a developer use to implement this?
Setup Audit Trail
Field History Tracking
Field Audit Trail
Big Objects
Refer to the following code snippet:
A developer created a JavaScript function as part of a Lightning web component (LWC) that surfaces information about Leads by wire calling getFetchLeadList when certain criteria are met.
Which three changes should the developer implement in the Apex class above to ensure the LWC can display data efficiently while preserving security?
Choose 3 answers
Implement the with sharing keyword in the class declaration.
Implement the without sharing keyword in the class declaration.
Use the WITH SECURITY_ENFORCED clause within the SOQL query.
Annotate the Apex method with @AuraEnabled(Cacheable=true).
Annotate the Apex method with @AuraEnabled.
What is a benefit of JavaScript remoting over Visualforce Remote Objects?
Allows for specified re-render targets
Supports complex server-side application logic
Does not require any Apex code
Does not require any JavaScript code
A developer is working with existing functionality that tracks how many times a stage has changed for an Opportunity. When the Opportunity's stage is changed, a workflow rule is fired to increase the value of a field by one. The developer wrote an after trigger to create a child record when the field changes from 4 to 5.
A user changes the stage of an Opportunity and manually sets the count field to 4. The count field updates to 5, but the child record is not created.
What is the reason this is happening?
After triggers are not fired after field updates.
After triggers fire before workflow rules.
Trigger.old does not contain the updated value of the count field.
Trigger.new does not change after a field update.
A developer has a test class that creates test data before making a mock callout but now receives a 'You have uncommitted work pending. Please commit or rollback before calling out' error.
Which step should be taken to resolve the error?
Ensure both the insertion and mock callout occur after the Test.stopTest().
Ensure both the insertion and mock callout occur after the Test.startTest().
Ensure the records are inserted before the Test.startTest() statement and the mock callout occurs within a method annotated with @testSetup.
Ensure the records are inserted before the Test.startTest() statement and the mock callout occurs after the Test.startTest().
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?
Does the screen need to be rendered as a PDF without using a third-party application?
Will the screen make use of a JavaScript framework?
Will the screen be accessed via a mobile app?
Does the screen need to be accessible from the Lightning Experience UI?
Which scenario requires a developer to use an Apex callout instead of Outbound Messaging?
The callout needs to be invoked from a flow.
The target system uses a REST API.
The target system uses a SOAP API.
The callout needs to be asynchronous.
Consider the following code snippet:
How should the <c-order> component communicate to the <c-selected-order> component that an order has been selected by the user?
Create and dispatch a custom event.
Create and fire an application event.
Create and fire a component event.
Create and fire a standard DOM event.
A developer has a requirement to query three fields (Id, Name, Type) from an Account; and first and last names for all Contacts associated with the Account.
Which option is the preferred, optimized method to achieve this for the Account named 'Ozone Electronics'?
A Visualforce page contains an industry select list and displays a table of Accounts that have a matching value in their Industry field.
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?
Add an <apex:actionSupport> within the <apex:selectOptions>.
Add an <apex:actionSupport> within the <apex:selectList>.
Add an <apex:actionFunction> within the <apex:selectionOptions>.
Add an <apex:actionFunction> within the <apex:selectList>.
Refer to the markup below:
A Lightning web component displays the Account name and two custom fields out of 275 that exists on the object. The custom fields are correctly declared and populated. However, the developer receives complaints that the component performs slowly.
What can the developer do to improve the performance?
Add density="compact" to the component.
Replace layout-type="Full" with layout-type="Partial".
Replace layout-type="Full"n with fields={fields}.
Add cache="true" to the component.
A developer is asked to build a solution that will automatically send an email to the customer when an Opportunity stage changes. The solution must scale to allow for 10,000 emails per day. The criteria to send the email should be evaluated after certain conditions are met.
What is the optimal way to accomplish this?
Use an Email Alert with Flow Builder.
Use MassEmailMessage() with an Apex trigger.
Use SingleEmailMessage() with an Apex trigger.
Use a Workflow Email Alert.
A developer wrote an Apex class to make several callouts to an external system.
If the URLs used in there callouts will change often, which feature should the developer use to minimize changes needed to the Apex class?
Session Id
Remote Site Settings
Named Credentials
Connected Apps
Users report that a button on a custom Lightning web component is not working. However, there are no other details provided.
What should the developer use to ensure error messages are properly displayed?
Add a try-catch block surrounding the DML statement.
Add JavaScript and HTML to display an error message.
Add the <apex:messages/> tag to the component.
Use the Database method with allOrNone set to false.
A developer is asked to look into an issue where a scheduled Apex is running into DML limits. Upon investigation, the developer finds that the number of records processed by the scheduled Apex has recently increased to more than 10,000.
What should the developer do to eliminate the limit exception error?
Use platform events.
Use the @future annotation.
Implement the Batchable interface.
Implement the Queueable interface.
A company accepts orders for customers in their enterprise resource planning (ERP) system that must be integrated into Salesforce as Order__c records with a lookup field to Account. The Account object has an external ID field, ERP_Customer_ID__c.
What should the integration use to create new Order__c records that will automatically be related to the correct Account?
Upsert on the Order__c object and specify the ERP_Customer_ID__c for the Account relationship.
Insert on the Order__c object followed by an update on the Order__c object.
Merge on the Order__c object and specify the ERP_Customer_ID__c for the Account relationship.
Upsert on the Account and specify trhe ERP_Customer_ID__c for the relationship.
Consider the below trigger intended to assign the Account to the manager of the Account's region:
Which two changes should a developer make in this trigger to adhere to best practices?
Choose 2 answers
Use a Map to cache the results of the Region__c query by Id.
Remove the last line that updates accountList because it is not needed.
Move the Region__c query outside the loop.
Add if (!accountList.isEmpty()) before update accountList.
A developer has a Batch Apex process, Batch_Account_Sales, that updates the sales amount for 10,000 Accounts on a nightly basis. The Batch Apex works as designed in the sandbox. However, the developer cannot get code coverage on the Batch Apex class.
The test class is below:
What is causing the code coverage problem?
The account creation already sets the sales amount to 0.
The batch needs more than one account record created.
The executebatch must fall within test.startTest() and test.stopTest().
The batch process will not recognize new accounts created in the same session.
Which three actions must be completed in a Lightning web component for a JavaScript file in a static resource to be loaded?
Choose 3 answers
Reference the static resource in a <script> tag.
Import the static resource.
Call loadScript.
Append the static resource to the DOM.
Import a method from the platformResourceLoader.
Consider the following code snippet:
As part of the deployment cycle, a developer creates the following test class:
When the test class runs, the assertion fails.
Which change should the developer implement in the Apex test method to ensure the test method executes successfully?
Add System.runAs(User) to line 14 and enclose line 14 within the Test.startTest() and Test.stopTest().
Add @IsTest(seeAllData=true) to line 12 and enclose lines 14 and 15 within Test.startTest() and Test.stopTest().
Query the Standard User into memory and enclose lines 14 and 15 within the System.runAs(user) method.
Query the Administrator user into memory and enclose lines 14 and 15 within the System.runAs(user) method.
Consider the following code snippet, depicting an Aura component:
Which two interfaces can the developer implement to make the component available as a quick action?
Choose 2 answers
force:hasRecordId
force:lightningQuickAction
force:lightningQuickActionWithoutHeader
force:hasSObjectName
An end user reports that a Lightning component is performing poorly.
Which two steps should be take in production to investigate?
Choose 2 answers
Use the Salesforce Lightning Inspector Chrome extension.
Enable Debug Mode for Lightning components.
Print console.log() statements to identify where actions are delayed.
Add a trace flag to the user who reported the issue.
Universal Containers (UC) currently does all development in its full copy sandbox.
Recently, UC has projects that require multiple developers to develop concurrently. UC is running into issues with developers making changes that cause errors in work done by other developers.
Additionally, when they are ready to deploy, many unit tests fail which prevents the deployment.
Which three types of orgs should be recommended to UC to eliminate these problems?
Choose 3 answers
Data Migration org
Continuous Integration (CI) Org
Staging org
Development org
Systems Integration org
A developer is trying to access org data from within a test class.
Which sObject type requires the test class to have (seeAllData=true) annotation?
RecordType
User
Report
Profile
Universal Containers wants to use a Customer Community with Customer Community Plus license to allow their customers access to track how many containers they have rented and when they are due back. Universal Containers uses a Private sharing model for External users.
Many of their customers are multi-national corporations with complex Account hierarchies. Each account on the hierarchy represents a department within the same business.
One of the requirements is to allow certain community users within the same Account hierarchy to see several departments' containers, based on a custom junction object that relates the Contact to the various Account records that represent the departments.
Which solution solves these requirements?
An Apex trigger that creates Apex managed sharing records based on the junction object's relationships
A custom list view on the junction object with filters that will show the proper record based on owner
A Lightning web component on the Community Home Page that uses Lightning Data Services.
A Visualforce page that uses a custom controller that specifies without sharing to expose the records
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 Apex code feature is required to facilitate this solution?
Report API
Dynamic variable binding
Dynamic SOQL
Streaming API
A developer creates an application event that has triggered an infinite loop.
What may have caused this problem?
The event handler calls a trigger.
The event is fired from a custom renderer.
An event is fired 'ontouchend' and is unhandled.
The event has multiple handlers registered in the project.
Refer to the test method below:
The test method tests an Apex trigger that the developer knows will make a lot of queries when a lot of Accounts are simultaneously updated to be customers.
The test method fails at the Line 20 because of too many SOQL queries.
What is the correct way to fix this?
Add Test.startTest() before and add Test.stopTest() after line 18 of the code.
Change the DataFactory class to create fewer Accounts so that the number of queries in the trigger is reduced.
Use Limits.getLimitQueries() to find the total number of queries that can be issued.
Add Test.startTest() before and add Test.stopTest() after both line 7 and Line 20 of the code.
A developer gets an error saying 'Maximum Trigger Depth Exceeded'.
What is a possible reason to get this error message?
A flow trigger was included too many times.
There are numerous DML operations in the trigger logic.
A trigger is recursively invoked more than 16 times.
The SOQL governor limits are being hit.
A developer is building a Lightning web component that displays quantity, unit price, and the total for an order line item. The total is calculated dynamically as the quantity multiplied by the unit price.
What must be added to display the total?
Add calculateTotal() { return quantity * unitPrice; } to the JavaScript and Total: {calculateTotal()} in the template.
Add Total: {multiply(quantity, unitPrice)} in the template.
Add Total: {quantity * unitPrice} in the template.
Add get total() { return quantity * unitPirce; } to the JavaScript and Total: {total} in the template.
A developer created an Apex class that updates an Account based on input from a Lightning web component that is used to register an Account. The update to the Account should only be made if it has not already been registered.
What should the developer do to ensure that users do not overwrite each other's updates to the same Account if they make updates at the same time?
Use upsert instead of update.
Use Database.update(account, false).
Use FOR UPDATE in a SOQL query.
Add a try/catch block around the update.
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?
Create a Process, execute a Queueable job from it, and make a callout from the Queueable job.
Create a Before Save Flow, execute a Queueable job from it, and make a callout from the Queueable job.
Create an Apex trigger, execute a Queueable job from it, and make a callout from the Queueable job.
Create a Workflow Rule, execute a Queueable job from it, and make a callout from the Queueable job.
A developer wants to integrate invoice and invoice line data into Salesforce from a custom billing system. The developer decides to make real-time callouts from the billing system using the SOAP API. Unfortunately, the developer is getting a lot of errors when inserting the invoice line data because the invoice header record does not exist yet.
What will help ensure the transactional integrity of the integration?
Develop a custom Apex web service to handle a custom JSON data structure with both invoice header and related invoice lines.
Create the invoice header and the related invoice lines in the same create() call leveraging External IDs.
Use an ETL tool and the Bulk API running nightly, thus ensuring all of the data is handled at the same time.
Set the AllOrNoneHeader to true when calling each of create() for invoice headers and create() for invoice lines.
A developer is writing code that requires making callouts to an external web service.
Which scenario necessitates that the callout be made in a @future method?
The callout could take longer than 60 seconds to complete.
Over 10 callouts will be made in a single transaction.
The callouts will be made in an Apex Trigger.
The callouts will be made in an Apex Test class.
Universal Containers (UC) has enabled the translation workbench and has translated picklist values. UC has a custom multi-select picklist field, Products__c, on the Account object that allows sales reps to specify which of UC's products an Account already has. A developer is tasked with writing an Apex method that retrieves Account records, including the Products__c field.
What should the developer do to ensure the value of Products__c is in the current user's language?
Call the translate() method on each record in the SOQL result list.
Use the locale clause in the SOQL query.
Set the local on each record in the SOQL result list.
Use toLabel(Products__c) in the fields list of the SOQL query.
A company uses Opportunities to track sales to their customers and their org has millions of Opportunities. They want to begin to track revenue over time through a related Revenue object.
As part of their initial implementation, they want to perform a one-time seeding of their data by automatically creating and populating Revenue records for Opportunities, based on complex logic.
They estimate that roughly 100,000 Opportunities will have Revenue records created and populated.
What is the optimal way to automate this?
Use System.scheduleJob() to schedule a Database.Scheduleable class.
Use Database.executeBatch() to invoke a Database.Batchable class.
Use System.enqueueJob() to invoke a Queueable class.
Use Database.executeBatch() to invoke a Queueable class.
Refer to the test method below:
The test method calls an @future method that increments the Number_of_Times_Viewed__c value. The assertion is failing because the Number_of_Times_Viewed__c equals 0.
What is the optimal way to fix this?
Change the assertion to System.assertEquals(0, acctAfter.Number_Of_Times_Viewed__c).
Add Test.startTest() before and Test.stopTest() after AuditUtil.incrementViewed.
Add Test.startTest() before and Test.stopTest() after insert acct.
Change the initialization to acct.Number_Of_Times_Viewed__c = 1.
Which statement is true regarding savepoints?
Reference to savepoints can cross trigger invocations.
Static variables are not reverted during a rollback.
Savepoints are not limited by DML statement governor limits.
You can roll back to any savepoint variable created in any order.
Refer to the Lightning component below:
The Lightning Component allows users to click a button to save their changes and then redirects them to a different page. Currently when the user hits the Save button, the records are getting saved, but they are not redirected.
Which three technique can a developer use to debug the JavaScript?
Choose 3 answers
Use Developer Console to view checkpoints.
Enable Debug Mode for Lightning components for the user.
Use Developer Console to view the debug log.
Use the browser's dev tools to debug the JavaScript.
Use console.log() messages in the JavaScript.
Which two queries are selective SOQL queries and can be used for a large data set of 200,000 Account records?
Choose 2 answers
SELECT Id FROM Account WHERE Name LIKE '%Partner'
SELECT Id FROM Account WHERE Name != ''
SELECT Id FROM Account WHERE Name IN (List of Names) AND Customer_Number__c = 'ValueA'
SELECT Id FROM Account WHERE Id IN (List of Account Ids)
A developer is creating a Lightning web component that contains a child component. The property stage is being passed from the parent to the child. The public property is changing, but the setOppList function is not being invoked.
What should the developer change to allow this?
Move the logic from connectedCallback() to renderedCallback().
Create a custom event from the parent component to set the property.
Move the logic to a getter/setter pair.
Move the logic from connectedCallback() to constructor().
Which technique can run custom logic when a Lightning web component is loaded?
Use an <aura:handler> init event to call a function.
Call $A.enqueueAction and pass in the method to call.
Use the connectedCallback() method.
Use the renderedCallback() method.
A developer creates a Lightning web component to allow a Contact to be quickly entered. However, error messages are not displayed.
Which component should the developer add to the form to display error messages?
apex:messages
lightning-messages
aura:messages
lightning-error
Get Cloudy Consulting (GCC) has a multitude of servers that host its customers' websites. GCC wants to provide a servers status page that is always on display in its call center. It should update in real time with any changes made to any servers. To accommodate this on the server side, a developer created a Server Update platform event.
The developer is working on a Lightning web component to display the information.
What should be added to the Lightning web component to allow the developer to interact with the Server Update platform event?
import { subscribe, unsubscribe, onError } from 'lightning/MessageChannel'
import { subscribe, unsubscribe, onError } from 'lightning/empApi';
import { subscribe, unsubscribe, onError } from 'lightning/pubsub'
import { subscribe, unsubscribe, onError } from 'lightning/ServerUpdate'
