Posts

Showing posts with the label dynamic

Salesforce Fact #946 | Constructing dynamic SOQL using dynamic formula evaluation

Image
With Summer'25 release, Dynamic formula evaluation is possible using  FormulaBuilder.parseAsTemplate() method and merge field syntax. This approach can be used to construct Dynamic SOQL queries. In this example, we are trying to fetch Account records which are matching with a Lead ownerid and Leadsource. Reference:  https://developer.salesforce.com/blogs/2025/05/summer25-developers Attached is the screenshot.

Salesforce Fact #940 | Dynamic related list for mobile app(Beta)

With the latest Summer'25 release, dynamic related lists are available(Beta) in Salesforce mobile app. To enable this, go to Setup -> Salesforce mobile app -> Enable ' Dynamic Forms and Dynamic Highlights Panel on Mobile' and Enable 'Dynamic Related Lists for Mobile (Beta)  '. Reference:  https://sahaabhishek1993-dev-ed.lightning.force.com/lightning/setup/SalesforceMobileAppQuickStart/home

Salesforce Fact #937 | Dynamic import of LWC

Image
With the Winter'24 release, we can use dynamic import for LWC components. Few things to keep a check: 1) The api version of the LWC should be >= 55.0 2) Lightning Web Security must be enabled in session settings. 3) The XML config file should use the lightning__dynamicComponent capability. However, we need to consider the performance overhead while using dynamic import and should use it selectively. Attached are the screenshots of an example. Reference:  https://developer.salesforce.com/docs/platform/lwc/guide/js-dynamic-components.html

Salesforce Fact #863 | Another POC using FormulaEvalInApex

Image
In order to fetch the currency conversion rate for a particular currency in Apex, we need to query CurrencyType or DatedConversionRate Sobject. We can make use of the FormulaEvalInApex feature to get the conversion rate using dynamic formula without the need of any SOQL. Attached is the screenshot.

Salesforce Fact #855 | Dynamic record picker in LWC

Image
We have a dynamic record picker in LWC. Using the combobox we can select the sobject and based on that we can set the objectApiName of the lightning record picker. Attached are the screenshots.

Salesforce Fact #763 | Dynamic helptext in screen flow using LWC

Image
Suppose we have a scenario in screen flow where we need to show dynamic help text for an input. Whatever value is entered in the input, the help text shows the value. We can implement this using an LWC. In this example, there is a number type input and the helptext shows the text based on the input entered. Attached are the screenshots. Note: The reactive beta feature setting needs to be enabled to pass the data from screen flow to LWC.

Salesforce Fact #716 | Using LIKE operator in dynamic SOQL

Image
How to use LIKE operator in dynamic SOQL? We can use a separate string variable to store the pattern part which includes the symbol '%' and use this as a bind variable or we can use extra single quotes before and after of '%'. Reference:  https://developer.salesforce.com/forums/?id=906F000000093YjIAI Attached is the screenshot.

Salesforce Fact #712 | Dynamic SOQL with multiple AND filters

Image
Suppose we need to construct an SOQL so that it contains multiple AND conditions based on the multiple filter values passed. If a particular filter value is passed only then it will be considered. We can have an apex method to construct the dynamic SOQL considering the possible scenarios. Attached are the screenshots.

Salesforce Fact #701 | Access custom label dynamically in apex

Image
We can now access custom labels in apex dynamically. With Summer'23 release, we have a new System.Label.get() method which returns the translation of a particular custom label for a particular language. Reference:  https://help.salesforce.com/s/articleView?id=release-notes.rn_apex_system_label_methods.htm&release=244&type=5 Note: passing the namespace as blank also returned the same results. Attached are the screenshots.

Salesforce Fact #665 | Dynamic maxrow selection in screen flow datatable

Image
We have a Data Table component type in screen flow. While configuring the row selection for a Data Table, if the Row selection mode is 'Multiple' we can set the min and max row selection values. Suppose, we want to keep the max row selection value dynamic i.e. it will be based on the length of the source collection and we want to allow the user to select the max number of rows which is equal to length of collection - 1. For this, we can take a number type resource and set its value with the length of the collection and use that one in the maximum selection section. Attached are the screenshots.

Salesforce Fact #547 | VF email template restriction

In VF email template, the messaging:htmlEmailBody and messaging:plainTextEmailBody tags can appear only once within a template. So, if we need to render some content in the email template dynamically, we can put conditional rendering on the content inside these tags.