How to send an email from a Salesforce sandbox to Gmail?
Question I am trying to send emails from a Salesforce sandbox to a Gmail address, but every attempt results in the following error: “Unauthenticated email from xyzyxz.com is not accepted due to domain’s DMARC policy.” All my email addresses in the sandbox use the domain xyzyxz.com, and it seems Gmail…
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,…
Best Practices for Deploying System Admin Profiles in Salesforce
Question: When working with Salesforce sandboxes and production environments, deploying profiles, particularly the System Admin profile, can be tricky, especially when the profile includes access to a large number of fields across objects. The issue arises when sandboxes have different configurations and objects, as well as varying field-level access, and…
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…
Downloading Large Files and Uploading to Salesforce Static Resources
Question: I need to download a large .gz file and upload it to Salesforce as a Static Resource. The file is significantly larger than Salesforce’s HTTP response size limit (6 MB), making direct download via an Apex HTTP callout infeasible. My goal is to: Answer: I attempted an HTTP callout…
Retrieving Components from Your Managed Package Version in Salesforce
Question: I have a developer org where I created a 1st-generation managed package with an assigned namespace. Over a year ago, I uploaded a released package version. Since then, I’ve implemented bug fixes, added features, and now plan to upload a new released package version. However, I need to create…
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…
What Is the Difference Between Controllers and Extensions in Visualforce?
Question: Can someone explain the usage of controllers and extensions in Visualforce? When should we use a controller, and in what scenarios should we opt for an extension instead? Answer: In Visualforce, controllers and extensions define the behavior of a page, dictating how it interacts with Salesforce data and performs…
Hide Specific Buttons on Order Products Related List?
Question: Is it possible to control the visibility of the “Add Products” and “Edit Products” buttons on the Order Products related list? The only solution we have found so far is to hide both buttons by disabling the “Show list view action bar” option. We then created two duplicate related…
Automating Admin Approved Users Policy for Managed Package Apps
Question: I am building a Managed Package that includes an External Client App using the JWT Bearer Token Flow for authentication. One critical requirement is to ensure that the OAuth Policy of the Connected App is set to “Admin approved users are pre-authorized” automatically when the package is installed in…

