Category: Dr. SFDC Scout
-
Dynamic/Reusable Table in LWC (Salesforce)

Use-case: Suppose in your application you have 10 tables to show. So instead of writing code for each table, you can think of this dynamic/reusable table. Create Dynamic/Reusable Table Create a Custom Metadata Type named Table_Column_Metadata__mdt. Add fields to store column information such as API_Name__c (API name of the field),…
-
How to add straight line in LWC (Salesforce)

CSS will do the job. Sharing sample code. Component: CSS:
-
How to avoid recursion in Salesforce

Recursion is a major problem in applications. It’s always better to keep the Recursion in mind before you implement any business automation requirement. Sharing some of the general strategy to avoid/fix recursion: Apex Class Apex Trigger Static in Salesforce are per transaction, so the value will be true only for…
-
How to create Free Salesforce Developer Org

It’s very simple. Just redirect to https://developer.salesforce.com/signup and fill all details and click on ‘Sign me up’. You will receive an email to setup the password. Just follow the instruction and you are good to create a developer edition org. Salesforce has implemented a restriction on creating accounts using a…
-
How To Add Line-break in Custom Label in Lightning Component

There are three ways you can achieve this. When you use this custom label in your Lightning Component, the \n escape sequence will be interpreted as a new line, and the text will appear on two separate lines. he newline escape sequence \n is not directly recognized and rendered as…
-
Salesforce Flow Error: Value of class com.force.swag.soap.Time is not a ValueType: STRING

It’s a simple but confusing error. You’re getting this error because flow doesn’t support Time Data Type and you are using Time data type field in your flow. Simply create a formula field of return type ‘Text’ and embed your time field from that. Now use this new formula field…
-
Generate Unique Random Auto-Number using Apex (medium-concurrency)

Generating high-concurrency unique random auto-number using Apex is very challenging, but using below code you can achieve a medium-concurrency situation.
-
How to create custom lookup/search or add lookup in LWC Component

This is the most common challenge developers face, as adding a looking field to custom table or form needs lots of complex coding. But we can leverage the use of ‘lightning-input-field’ to create a search bar or add lookup field to your form/custom table in LWC. Case1: Add Lookup field…
-
How to get salesforce base URL in Apex.

You can get that using System.URL class. You will find the complete documentation HERE. Below code snippet will give you the base URL and then you can concatenate with record ID to make record detail page URL. You can also run above code in anonymous window to check the output.
-
How to get Picklist Label instead of API in Apex

When we query any picklist field on any object in Apex, we always get the API name of it but if you want the label of the picklist then you can use ‘toLabel’. Suppose we have a custom field named ‘Status__c’ on the ‘Contact’ Object, then the below query will…
