How to Write Test Class for Invokable and @Future Callout?
Question: I’m new to Apex and trying to learn as much as possible. I have two Apex classes that are working fine in my org. The first class is an Invokable Apex class. This class is triggered by a Process Builder when certain conditions are met on the Lead object….
Why Can’t I Add a Property to the Apex Result Array?
Question I’m trying to add a new property called showDeleteButton to each object in the result array returned from an Apex call. However, when I include the result.forEach line, the code after it does not execute. It seems like the mutation is not working as expected, and the array remains…
Batch Apex Scenarios in Salesforce
Table Of Contents In the realm of Salesforce, managing vast datasets efficiently is crucial for maintaining system performance and ensuring smooth business operations. Enter Batch Apex, a powerful feature designed to handle large volumes of data in Salesforce seamlessly. As businesses face increasing data complexities, understanding and leveraging Batch Apex…
How to Improve Schema Access Performance in Apex?
Question When working with Apex code that needs to interrogate the schema for dynamic behavior, such as defining fields that should be loaded or saved for specific objects (e.g., “Account” or “MyCustomObject__c”), it can be slow and resource-intensive, especially when using calls like Schema.getGlobalDescribe() or Schema.describeSObjects(types). These calls often consume…
Why Isn’t My URL Button Working on Mobile?
Question I have a Lightning Web Component (LWC) that is URL Addressable and defined as follows: The component retrieves the record ID from the URL parameters using CurrentPageReference: The init() method makes an Apex call using the oppId. I created a custom URL button on the Opportunity record page with…
What Are the Differences Between Visualforce Messaging Options?
Question What Are the Differences Between Visualforce Messaging Components and Their Use Cases? Visualforce provides multiple messaging components like , , , and to handle errors, warnings, and informational messages. However, the exact differences between these components and their ideal use cases can be confusing, especially since Salesforce documentation can…
Apex API 61: No More Private Method Overriding?
Question After upgrading from API version 60.0 to 61.0, I noticed an unexpected change in the behavior of inheritance for inner classes in Apex. Specifically, I observed that private methods in a superclass are no longer overridden by an inner class in the subclass when both methods have the same…
How to Retrieve Public Email Templates by FolderName?
Question I have been trying to retrieve all the public email templates by querying for templates within the ‘Public Email Templates’ folder. Here’s the query I attempted: However, this query does not seem to work. When querying an email template, I can see that the Folder.Name indeed displays as ‘Public…
Handling Complex Data Types in Dynamic SOQL Queries in Apex
Question How Can I Elegantly Convert a Set of Ids into a String for Use in a Dynamic SOQL IN Comparison? When I have a Set and need to use it in a dynamic SOQL query for an IN comparison, I currently convert the set into a string in the…
Get Dependent Picklist Values in Apex?
Question I have a pair of dependent picklists in Salesforce. In Apex code, how can I determine the valid options in the dependent field for each value in the controlling field? For example, consider the following picklists: Controlling Field (Controlling_Field__c): Dependent Field (Dependent_Field__c): I tried using getPicklistValues(), but it does…

