Posts

Showing posts from September, 2024

Salesforce Fact #879 | Removing decimals in JS

Image
In order to remove decimals from a number in JS, we can make use of the bitwise not operator. Same can be used in LWC. Attached is an example screenshot.

Salesforce Fact #878 | (already output) error in debug log

Image
Have you encountered the error (already output) in the debug log? This error is encountered whenever the collection is not initialized or reinitialized properly in the code logic and it might lead to unexpected results. Reference:  https://salesforce.stackexchange.com/questions/290468/to-know-more-about-already-output-in-logs Attached is an example screenshot.

Salesforce Fact #877 | Exploring lwc-codemod tool

Image
At times, we face difficulty in debugging syntax issues in HTML file in LWC. The lwc-codemod tool can help on resolving few of the HTML syntax errors. To get this working, once the tool is installed, we need to use the following command: lwc-codemod html-template-cleanup <path> path is the directory where the LWC is located. Reference:  https://github.com/salesforce/lwc-codemod?tab=readme-ov-file Attached are example screenshots.

Salesforce Fact #876 | PICKLISTCOUNT() in FormulaEvalInApex

Image
While using the PICKLISTCOUNT() function in the FormulaEvalInApex feature, it counts the number of semicolons unlike the PICKLISTCOUNT() function in the formula which returns the number of selected values in the multi-select picklist. So, we need to be careful if we use  FormulaEvalInApex  feature with PICKLISTCOUNT(). Ideally the correct result is returned count+1. Attached is the screenshot.

Salesforce Fact #875 | Checking custom metadata access in PS

Suppose we need to find out which all permission sets have a particular custom metadata access enabled. For this, first we need to find out the object Id of the custom metadata and using that object id we can get the list of permission sets. In this example, first we are getting the object id of the custom metadata. This can be obtained either from the url or by querying the CustomObject as below: SELECT Id FROM CustomObject WHERE DeveloperName='Parent_Metadata' Next, we query on SetupEntityAccess like below: SELECT Id, Parent.name, SetupEntityId, SetupEntityType, SystemModstamp FROM SetupEntityAccess WHERE parent.isownedbyprofile=False AND SetupEntityId IN ('01I6F000003cdLBUAY')

Salesforce Fact #874 | Assigning Labels to records

As part of the latest release, we can now assign labels to individual records. This is pretty helpful in maitaining a categorization of multiple related records. The Sobject for Label is UserDefinedLabel and the assignments to records are tracked using UserDefinedLabelAssignment Sobject. In order to assign labels, the user needs to have access to Label object. Further details:  https://help.salesforce.com/s/articleView?id=release-notes.rn_sales_features_core_record_labels.htm&release=250&type=5

Salesforce Fact #873 | Exploring screen flow action button(Beta)

Image
With Summer'24 release, we can now access the screen flow action button feature as a Beta feature. As a use case, we know that capitalizing text does not work properly with screen flow reactivity. We can make use of a subflow which takes a string as input and returns the capitalized version. In this example, we are calling the subflow from a action button and the returned text is also set on the actual input with the help of formula resource 'InputDisplayValue'. Attached are the screenshots.