Universal Containers wants to assess the advantages of declarative development versus programmatic customization for specific use cases in its Salesforce implementation.
What are two characteristics of declarative development over programmatic customization? Choose 2 answers
Options:
A.
Declarative code logic does not require maintenance or review.
B.
Declarative development has higher design limits and query limits.
C.
Declarative development can be done using the setup menu.
D.
Declarative development does not require Apex test classes.
Answer:
C, D
Explanation:
Explanation:
Declarative development is the process of configuring and customizing the Salesforce platform using its built-in tools, such as the setup menu, without writing any code. Declarative development has the following advantages over programmatic customization, which involves writing custom code using Apex, Visualforce, or other languages:
Declarative development can be done by anyone who knows how to use the Salesforce user interface, without requiring any programming knowledge or skills. Programmatic customization requires a skilled developer who knows how to write, test, and debug code.
Declarative development does not require Apex test classes, which are mandatory for deploying any custom code to production. Apex test classes are used to verify the functionality and quality of the code, and to ensure that it meets the code coverage requirement of at least 75%. Declarative development does not have this requirement, as the platform automatically validates the configuration and customization.
Declarative development is faster and easier to implement, as it involves clicking and dragging components, setting properties, and defining rules. Programmatic customization is more time-consuming and complex, as it involves writing lines of code, using development tools, and following coding standards and best practices.
However, declarative development also has some limitations and disadvantages compared to programmatic customization, such as:
Declarative development has lower design limits and query limits than programmatic customization. Design limits are the maximum number of components, fields, objects, rules, etc. that can be used in a Salesforce org. Query limits are the maximum number of records that can be retrieved or manipulated in a single transaction. Programmatic customization can bypass some of these limits by using techniques such as dynamic SOQL, batch Apex, or asynchronous Apex.
Declarative development has less flexibility and control over the functionality and user interface than programmatic customization. Programmatic customization can create custom logic, automation, integration, and user interface that are not possible or supported by the declarative tools. For example, programmatic customization can use Apex triggers to execute logic before or after a record is inserted, updated, deleted, or undeleted, while declarative development can only use workflow rules or process builder to execute logic after a record is created or updated.
Declarative development can become difficult to maintain and troubleshoot as the complexity and number of components, rules, and dependencies increase. Programmatic customization can be more organized and modular, as it can use classes, methods, variables, comments, and annotations to structure and document the code.
Therefore, the best practice is to use a combination of declarative and programmatic development, depending on the use case and the requirements. The general rule of thumb is to use declarative development whenever possible, and use programmatic customization only when necessary or when it provides significant benefits.
References:
Programmatic vs Declarative: Are Clicks Better Than Code?
Clicks Not Code: Benefits of Declarative Vs. Imperative Programming
Review Developer Fundamentals Unit
Question 69
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 70
Which statement describes the execution order when trigger are associated to the same object and event?
Options:
A.
Triggers are executed in the order they are created..
B.
Trigger execution order cannot be guaranteed.
C.
Triggers are executed in the order they are modified
D.
Triggers are executed alphabetically by trigger name.
Answer:
B
Explanation:
Explanation:
When multiple triggers are associated to the same object and event, such as before insert, Salesforce does not guarantee the order of execution of those triggers. Therefore, it is best practice to avoid having multiple triggers for the same object and event, and instead consolidate the logic into a single trigger handler class. This way, you can control the order of execution of your trigger logic and avoid unexpected results or conflicts. References: Triggers and Order of Execution, Best Practices for Implementing Salesforce Triggers, Trigger Order Of Execution In Apex