How Can We Deploy Apex Classes That Are Scheduled?

On July 10, 2025, Posted by , In Apex,Salesforce, By ,, , With Comments Off on How Can We Deploy Apex Classes That Are Scheduled?

Question When deploying Apex classes that are scheduled, the main challenge is that Salesforce locks scheduled Apex jobs to the specific class they reference. This can cause deployment failures if you try to update a scheduled class without first unscheduling its jobs. How can we effectively deploy updates to scheduled…

Why Can’t I Add a Property to the Apex Result Array?

On June 28, 2025, Posted by , In Apex,Lightning web components,Salesforce, By ,,, , With Comments Off on 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…

Apex API 61: No More Private Method Overriding?

On June 22, 2025, Posted by , In Apex,Salesforce, By ,,, , With Comments Off on 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 Automate Password Expiry Reminders?

On June 18, 2025, Posted by , In Salesforce, By ,, , With Comments Off on How to Automate Password Expiry Reminders?

Question I want to automate the process of sending email reminders to Customer Community users when their password is about to expire in 7 days. However, my organization uses multiple profiles for Customer Community users, and each profile has its own password expiration policy (e.g., 90-day expiration, 180-day expiration, etc.)….

What Are Controllers and Extensions in Visualforce?

On June 10, 2025, Posted by , In Apex, By ,,, , With Comments Off on What Are Controllers and Extensions in Visualforce?

Question Explain the usage of controllers and extensions in Visualforce, and in which scenarios should each be used? Answer In Visualforce, controllers and extensions are both used to manage the logic of your page, but they serve distinct roles and have different characteristics. Understanding the difference is crucial to using…

How Do I Work with JSON in Apex?

On June 6, 2025, Posted by , In Apex,Salesforce, By ,,, , With Comments Off on How Do I Work with JSON in Apex?

Question This is a canonical question and answer developed by the community to help address common questions. If your question was closed as a duplicate or you were directed here, please review the resources provided and use them to refine your specific inquiry. To explore more canonical Q&A, visit the…

How to Test Apex code with Field History Tracking?

On May 6, 2025, Posted by , In Apex,Salesforce Technical Questions, By ,,, , With Comments Off on How to Test Apex code with Field History Tracking?

Question In Salesforce, testing Apex code that relies on field history tracking can be challenging because field history records are not automatically created during tests. This issue arises when the code queries history records, such as those for custom objects. Although the code works in production, the tests fail because…

How Does Test Coverage Work for Enums and Properties in Apex?

On April 8, 2025, Posted by , In Apex,Salesforce, By ,, , With Comments Off on How Does Test Coverage Work for Enums and Properties in Apex?

Question: I recently noticed some unusual behavior in Apex test coverage and wanted to confirm whether this has always been the case or if something has changed over time. Specifically, I observed that: Consider the following class containing only an enum: Even when this enum is used in test cases,…

Can You Set Lookup Fields with __r and External IDs?

On April 4, 2025, Posted by , In Apex,Salesforce, By ,, , With Comments Off on Can You Set Lookup Fields with __r and External IDs?

Question Is it possible to set a lookup field in Apex by using the relationship field (__r) and an external ID? For example, can we relate a child record to its parent by specifying the parent object with just an external ID value? If yes, how does it work, and…