How to Clone a Record with Related Lists?
Question: I need to clone all Account records along with their associated Contact records. I am using the clone() method in Apex for this. Below is the code I have written: I am unable to figure out how to associate the cloned contacts with the corresponding cloned accounts. Since the…
How to Run a Scheduled Job Every 15 Minutes?
Question: Salesforce’s built-in GUI for scheduling jobs does not allow setting an interval shorter than one day. However, I need to run a scheduled job every 15 minutes. How can I achieve this in Apex? CRS Info Solutions offers industry-leading Salesforce training in Singapore with real-time projects, Salesforce training certification guidance, interview coaching, and…
Why Are Session IDs Different Across Contexts in Salesforce?
Question: I’m implementing an OAuth flow between two Salesforce instances. A challenge I’m facing is maintaining sessions when the target instance has the same instance URL as the origin instance, causing users to be logged out of the original instance upon login to the other. To address this, I’m using…
Dynamic REST API JSON Body Using Field Sets in Apex
Question: I need to construct the request body for a REST POST call in which the key (Field API Name) and its corresponding value are dynamically included in JSON format. The field API names are retrieved from a field set, and the values come from a database query. For example,…
Publishing Platform Event with JSON in a Text Field?
Question When attempting to publish a Platform Event with a valid JSON object inside a custom text field (Message__c), the serialized JSON string appears with backslashes before special characters such as double quotes (“). For example, when assigning the following JSON to Message__c: The resulting event payload contains an escaped…
CheckMarx FLS Violations for Dynamic SObjects in Apex?
Question: In Salesforce Apex, handling objects dynamically using the generic SObject type allows for flexible and reusable code that can work across different Salesforce objects. However, this dynamic approach creates challenges for static code analysis tools like CheckMarx and PMD. For example, consider the following code snippet where QuoteLineItem records…
How to Delete Triggers or Classes from Production in Salesforce?
Question I’m encountering some confusion with deleting components in production. I understand that you can’t delete a class directly in production—you must remove it in your sandbox and then deploy the deletion using a package. However, when I delete a trigger in my sandbox, it doesn’t show up as a…
Getting Started with Writing Code in Salesforce Developer Console
Salesforce provides a powerful cloud-based platform for developing applications, and the Salesforce Developer Console is a built-in tool that allows developers to write, test, and debug Apex code efficiently. For those getting started with writing code in Salesforce Developer Console, this guide will provide a solid foundation. Enhance your expertise…
How to Deploy Apex Classes That Are Scheduled?
Question How can we manage scheduled jobs in Salesforce to allow updates to the classes they reference? Specifically, is there a way to use Type.forName or other techniques to decouple classes from scheduled jobs and enable seamless deployments of Apex classes? How do we deploy Apex classes that are scheduled?…
10 Practice Problems for APEX Triggers: A Beginner’s Guide
Apex triggers are essential tools in Salesforce development, allowing you to automate processes and create custom behaviors. Whether you’re a fresher or an experienced developer, practicing Apex trigger problems can significantly boost your understanding. In this post, I’ll walk you through 7 practice problems for Apex triggers that can help…

