What are static code analysis tools for Apex?
Question: Are there any static code analysis tools available for Apex? I am aware of the Force.com Security Source Code Scanner, but it has the drawback of requiring requests to be placed in a queue and run remotely, which slows down the development process. Is there a tool I can…
Why Is My Salesforce Webhook Returning “FORBIDDEN”?
Question I recently set up a Stripe Webhook endpoint in our Salesforce sandbox, and it worked perfectly when tested via Postman and Stripe. However, after deploying it to production, I started encountering the following error whenever I tried to access the endpoint via Postman or directly in a browser: I…
How Can I Tell the Day of the Week of a Date?
Determining the day of the week from a given date is a common requirement when building logic in Salesforce. You might be asking, “How can I tell the day of the week of a date?” You can achieve this using Apex code or Salesforce formulas. Here’s how to approach this…
Does JSON Serialization Break SObject Equality?
Question: When an SObject containing Decimal fields is serialized and deserialized using JSON, the equality operator (==) no longer returns true, even if the field values appear identical. Why does this happen, and how can it be fixed? For example: Interestingly, if the Amount field values are logged: The values…
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 to Deserialize a JSON String in Apex?
Question: How can I deserialize the following JSON string into Apex? I’ve tried using the following code to deserialize it: The code works, but I’m looking for a more efficient and simpler way to handle this. Any suggestions? Answer: A more efficient and structured approach would be to generate Apex…
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 use Tooling API in Apex?
Question: How can I use the Tooling API in Salesforce to create an Apex class programmatically within an Apex controller? I am particularly interested in seeing an example that demonstrates how to achieve this. I have already generated MetadataService from WSDL but am open to other approaches, including REST-based methods….

