Category Archives : Salesforce Technical Questions

Fetching URL Parameters in a Lightning Component?

On May 27, 2025, Posted by , In LWC Essentials,Salesforce Technical Questions, With Comments Off on Fetching URL Parameters in a Lightning Component?

Question: I am working with Communities in Salesforce Lightning and trying to fetch URL parameters directly into the attributes of a Lightning component without using JavaScript. For example, given the URL: https://www.someurl.com/page?name=somename&surname=somesurname I want to bind the name and surname parameters directly to attributes in my Lightning component so that…

How to Disable CommandButton After First Click in VF?

On May 27, 2025, Posted by , In Salesforce Technical Questions, With Comments Off on How to Disable CommandButton After First Click in VF?

Question When developing a Visualforce page, you may encounter a scenario where users click a commandButton multiple times before the page completes its redirect or processing action. This can cause multiple submissions, leading to potential data issues or performance problems. How can you ensure that the button gets disabled after…

Why Is DML Not Allowed in Constructors?

On May 25, 2025, Posted by , In Apex,Salesforce Technical Questions, With Comments Off on Why Is DML Not Allowed in Constructors?

Question: Why is it not allowed to perform DML operations within an Apex class constructor? Is there a specific reason for this restriction? Despite searching extensively, the rationale behind this limitation doesn’t appear to be well-documented. Answer: DML operations are not allowed in constructors because of potential side effects that…

Why Components Persist During Navigation in Lightning?

On May 23, 2025, Posted by , In LWC Essentials,Salesforce Technical Questions, With Comments Off on Why Components Persist During Navigation in Lightning?

Question: In Salesforce Lightning Experience, I have custom Lightning pages and apps, both overriding default record views and serving as standalone pages accessed from the sidebar. However, when navigating from one tab to another, the components seem to only be hidden rather than destroyed. Upon navigating back to the tab,…

Execute JavaScript on Salesforce Standard Page?

On May 21, 2025, Posted by , In JavaScript,Salesforce Technical Questions, With Comments Off on Execute JavaScript on Salesforce Standard Page?

Question: Is there a way to execute JavaScript on a Salesforce standard detail page? Specifically, I need to remove the “New Note” button from the Notes & Attachments related list while retaining the ability to add Attachments. Additionally, I want to rename the related list to “Attachments” for better clarity….

How to Make a PATCH HTTP Callout in Apex?

On May 19, 2025, Posted by , In Apex,Salesforce Technical Questions, With Comments Off on How to Make a PATCH HTTP Callout in Apex?

Question: How can I make a PATCH HTTP callout from Apex? I discovered that the HttpRequest class in Apex does not directly support the PATCH method. When attempting to send a PATCH request, I receive a System.CalloutException: Invalid HTTP method: PATCH. This is problematic because I need to call out…

What Are Salesforce IDs Composed Of?

On May 17, 2025, Posted by , In Salesforce Technical Questions, With Comments Off on What Are Salesforce IDs Composed Of?

Question: Salesforce IDs are widely used to uniquely identify records, but what exactly are they composed of? I’ve come across references suggesting that different segments of the ID represent specific meanings—for example, the first few characters indicating the type of sObject. Could you explain this in detail? Additionally, how can…

Assembling HTML Letterhead Emails in APEX?

On May 15, 2025, Posted by , In Apex,Salesforce Technical Questions, With Comments Off on Assembling HTML Letterhead Emails in APEX?

Question: How can I merge HTML from an EmailTemplate and BrandTemplate into a single, fully-assembled HTML document using APEX? I am working on an email service integration project and need to combine the contents of two Salesforce objects: Salesforce does not natively support CDATA manipulation, and my attempts to parse…

How to Unit Test Callouts in Apex?

On May 13, 2025, Posted by , In Apex,Salesforce Technical Questions, With Comments Off on How to Unit Test Callouts in Apex?

Question: How do I unit test Apex code that includes a SOAP or REST-based callout or indirectly calls code that makes a callout? I am getting an error saying that callouts are not supported during test execution. Answer: Salesforce enforces test isolation, which means you cannot make REST or SOAP…