A develop completed modification to a customized feature that is comprised of two elements:
Apex trigger
Trigger handler Apex class
What are two factors that the developer must take into account to properly deploy the modification to the production environment?
Options:
A.
Apex classes must have at least 75% code coverage org-wide.
B.
At least one line of code must be executed for the Apex trigger.
C.
All methods in the test classes must use @isTest.
D.
Test methods must be declared with the testMethod keyword.
Answer:
A, B
Explanation:
Explanation:
To deploy Apex code to a production environment, the developer must ensure that the Apex classes have at least 75% code coverage org-wide, and that all triggers have some code coverage. This means that at least one line of code must be executed for the Apex trigger during the test execution. Code coverage is a measure of how many lines of code are executed by the test methods. Code coverage helps to ensure that the Apex code works as expected and that it does not break any existing functionality. Code coverage also helps to prevent deploying code that has not been tested or that has bugs. All methods in the test classes must use @isTest or the testMethod keyword, but this is not a factor for deploying the modification, as it is a requirement for creating the test classes in the first place. The @isTest annotation and the testMethod keyword are equivalent ways of marking a method as a test method. Test methods are methods that verify the functionality of the Apex code and do not count against the code limit of the organization. References:
Apex Developer Guide: Testing Apex, pages 1-2
Trailhead: Platform Developer I Certification Study Guide: Apex Testing, unit 6
Question 41
A Salesforce Administrator used Flow Builder to create a flow named ‘’accountOnboarding’’. The flow must be used inside an Aura component.
Which tag should a developer use to display the flow in the component?
Options:
A.
Lightning-flow
B.
Aura:flow
C.
Lightning:flow
D.
Aura:flow
Answer:
C
Explanation:
Explanation:
The developer should use the Lightning:flow tag to display the flow in the Aura component. The Lightning:flow tag is a base Lightning component that allows you to embed a flow in an Aura component and interact with it programmatically. The Lightning:flow tag has attributes that let you specify the name of the flow, pass input values to the flow, handle the flow status change event, and control the flow navigation. The Lightning:flow tag supports only screen flows and autolaunched flows.
The other options are not valid tags for displaying a flow in an Aura component. There is no such tag as Lightning-flow or Aura:flow. The aura:component tag is the root tag of the Aura component hierarchy, but it does not display a flow by itself.
References: lightning:flow - documentation, Use Aura Components with Flows, Prepare for Your Salesforce Platform Developer I Credential
Question 42
Which three steps allow a custom SVG to be included in a Lightning web component? Choose 3 answers
Options:
A.
Upload the SVG as a static resource.
B.
Import the static resource and provide a getter for it in JavaScript.
C.
Reference the getter in the HTML template.
D.
Reference the import in the HTML template.
E.
Import the SVG as a content asset file.
Answer:
A, B, C
Explanation:
Explanation:
To include a custom SVG in a Lightning web component, you need to follow these three steps:
Upload the SVG as a static resource. You can use the Static Resource page in Setup or the Salesforce CLI to upload the SVG file as a static resource. You need to give it a name and a description, and optionally specify a cache control setting1.
Import the static resource and provide a getter for it in JavaScript. In your Lightning web component’s JavaScript file, you need to import the static resource using the @salesforce/resourceUrl module. Then, you need to define a getter function that returns the URL of the static resource2. For example:
JavaScript
import { LightningElement } from 'lwc';
import customSVG from '@salesforce/resourceUrl/customSVG';
export default class MyComponent extends LightningElement {
get svgURL() {
return customSVG;
}
}
AI-generated code. Review and use carefully. More info on FAQ.
Reference the getter in the HTML template. In your Lightning web component’s HTML template, you need to use the
HTML
AI-generated code. Review and use carefully. More info on FAQ.
In the JavaScript file, you also need to define a handleSVGLoaded method that uses the XMLHttpRequest object to fetch the SVG content and append it to the
JavaScript
handleSVGLoaded(event) {
const svgElement = event.target;
const xhr = new XMLHttpRequest();
xhr.open('GET', this.svgURL, true);
xhr.onload = () => {
svgElement.innerHTML = xhr.responseText;
};
xhr.send();
}
AI-generated code. Review and use carefully. More info on FAQ.
References:
1: Create and Upload a Static Resource (Lightning Web Components Developer Guide)
2: Use a Static Resource (Lightning Web Components Developer Guide)
3: Use lwc:dom=“manual” (Lightning Web Components Developer Guide)
4: Load the SVG Content (Lightning Web Components Developer Guide)
Question 43
A developer deployed a trigger to update the status__c of Assets related to an Account when the Account’'s status changes and a nightly integration that updates Accounts in bulk has started to fail with limit failures.
What should the developer change about the code to address the failure while still having the code update all of the Assets correctly?
Options:
A.
Change the gerAssetsToUpdac= method to process all Accounts in one call and call it outside of the for loop that starts on line 03.
B.
Add a LIMIT clause to the SOQL query on line 16 to limit the number of Assets queried for an Account.
C.
Move all of the logic to a Queueable class that queries for and updates the Assets and call it from the trigger.
D.
Add List assets = [SELECT Id, Status__c FROM Asset WHERE AccountId = :acctId] to line 14 and iterate over the assets list in the for loop on line 15.
Answer:
C
Explanation:
Explanation:
The correct answer is to move all of the logic to a Queueable class that queries for and updates the Assets and call it from the trigger. This is because when dealing with bulk data, triggers can often hit governor limits. By utilizing a Queueable class, the developer can perform asynchronous processing which helps in handling more records and avoiding hitting governor limits. References: The Salesforce Platform Developer I Learning documents emphasize on understanding the governor limits and how to write efficient code that can handle bulk data without hitting these limits. Asynchronous processing like Batch Apex, Future methods, or Queueable Apex is often recommended for bulk data handling. You can find more information on these topics in the following links: Apex Developer Guide, Trailhead