Category: Dr. SFDC Scout
-
How to get Picklist field API and Label both in Apex

This requirement can be achieved using Schema class. PFB one example UtilityClass which will return the API to Label mapping. PFB the Output:
-
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 Define a Custom Metadata Type: Create a Custom Metadata Type named Table_Column_Metadata__mdt. Add fields to store column information such as API_Name__c…
-
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: Use a Static Variable or Flag: One common approach is to use a static boolean variable as a…
-
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. Add ‘\n’ at the end of each string Add ‘<br>’ at the end of each string Add any special character at the end of each string & then in JS file break the lines. (If above options don’t work then go for…
-
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.
