Retrieve the first element from a SET using Apex

Greetings, Trailblazers, You’re likely aware of the distinction between LIST and SET in Apex. You might be curious about accessing the first (or any) element of a SET without iterating. Through iteration, this can be easily accomplished. Without the need for iteration – Here’s a straightforward technique, #Salesforce #Apex

Use force:refreshView (or getRecordNotifyChange) in a Lightning web component.

We have a strong appreciation for the Lightning UI and the aura feature (e.force:refreshview), which updates the data on the current Lightning page, record, or component. However, we found that this feature was missing in LWC, and many resorted to using a combination of Aura and LWC to achieve this functionality. As of Winter ’21, …

Use force:refreshView (or getRecordNotifyChange) in a Lightning web component. Read More »

Best Practices and Considerations for Lightning Web Components (LWC).

Hello again! This blog post takes a unique approach as it will continuously receive updates with the latest findings. I will be sharing best practices and considerations related to LWC, drawing from both Salesforce guidelines and personal experiences. Let’s begin with the topic of FOR LOOPS. 1- FOR LOOPS JavaScript ES6 introduces a distinct type …

Best Practices and Considerations for Lightning Web Components (LWC). Read More »

Retrieve the values of Object and Field Labels using API Names.

This scenario frequently arises when you possess the API Name but require the current labels for your object or field, whether it’s custom or standard. While you usually have this information in advance, there are instances where it becomes necessary when dynamically composing your Apex. Presented here is a straightforward method that takes API Names …

Retrieve the values of Object and Field Labels using API Names. Read More »

Apex test cases encounter failures when executed concurrently.

At present, when running Apex test cases through either Apex Test Execution or ApexTestQueueItem records, two cases are executed simultaneously. Typically, this is not problematic; however, issues may arise if the test cases lack complete isolation (e.g., they operate on the same records) and data isolation is disabled. Failures might occur that wouldn’t manifest if …

Apex test cases encounter failures when executed concurrently. Read More »

Static Resource Test Class Data

By utilizing the Test.loadData method, you can effortlessly input data into your test methods, eliminating the need for extensive code. Just follow these steps: For instance, if you’re dealing with Account records and the static resource is named myResource, make the following call: The Test.loadData method provides a list of sObjects corresponding to each inserted …

Static Resource Test Class Data Read More »

Toggle Class Dynamically in Lightning Web Components (LWC)

In this straightforward situation, the objective is to toggle the visibility of a div, but the conventional <template if:true> tag is not applicable. Consider a scenario where a loop is in use. We will explore two alternative methods for achieving dynamic show/hide functionality in LWC without relying on the <template if:true> approach. Simplified Method for …

Toggle Class Dynamically in Lightning Web Components (LWC) Read More »