Posts

Showing posts from August, 2024

Salesforce Fact #872 | Query custom label translations

It is possible to query custom label translations using Tooling API and using the object ExternalStringLocalization. Below is a sample query: SELECT Id   ,ExternalStringId   ,ExternalString.Name   ,ExternalString.Value   ,Value   ,Language  FROM ExternalStringLocalization  ORDER BY ExternalString.MasterLabel, Language Reference:  https://salesforce.stackexchange.com/questions/357686/can-i-query-for-custom-label-translationshttps://salesforce.stackexchange.com/questions/357686/can-i-query-for-custom-label-translations

Salesforce Fact #871 | Sobject Tree API in action

Image
With the Sobject Tree API, it is possible to create parent record with multiple child records using the same request. In this example, we are creating two account records, one with two related contacts and another one with two related opportunities in the same POST request. Reference:  https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_composite_sobject_tree.htm Attached are the screenshots.

Salesforce Fact #870 | Lock selected records from list view using screen flow

Image
With the latest release, we can now lock and unlock records using flow action. We can create a screen flow which would accept the selected records from the list view and would lock the records using Lock Record action. We need to keep a check before locking the record and it will be locked if it is not locked yet. Attached are the screenshots. Note: Lock and Unlock record operation is counted as one DML operation each. So, it is not a good practice to call the action inside loop. In this example, it has been called inside loop since the lock action currently supports single recordid, not list of ids.

Salesforce Fact #869 | Show entered password in screen flow

Image
Similar to LWC, Show password logic can be implemented in screen flow as well using reactivity and component visibility. Attached are the screenshots.

Salesforce Fact #868 | Show entered password in LWC

Image
In most of the login pages, we have a checkbox option to show the entered password. We can implement the same in LWC with a bit of logic. Attached are the screenshots.

Salesforce Fact #867 | Getting users for selected user role in screen flow

Image
Here's another example of screen flow reactivity along with LWC lightning record picker. In this example, we have a picklist of list of user roles in screen flow and on selecting a role, we are showing a filtered record picker with users corresponding to the selected role. Attached are the screenshots.

Salesforce Fact #866 | Getting user language and locale using i18n

Image
Besides using @salesforce/user module, We can get the UserLocale and Language using @salesforce/i18n scoped module as well in LWC. Reference:  https://developer.salesforce.com/docs/platform/lwc/guide/create-i18n.html Attached is the screenshot.

Salesforce Fact #865 | Null coalescing in JS

Image
We have null coalescing operator in JS as well and it works only with null and undefined. Attached is the screenshot.

Salesforce Fact #864 | Using null coalescing and safe navigation together in Apex

Image
Suppose we have a Map<String, List<Id>> and based on some condition checks, we need to add or update the list as part of the map value with respect to key value. We can do the check a bit differently using both safe navigation and null coalescing operator. In this example, we are storing the list of Ids in map specific to object key prefix. Attached are the screenshots.

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.