Posts

Showing posts from July, 2022

Salesforce Fact #481 | Approval request comment limit

Approval request comments are limited to 4000 characters. In Chinese, Japanse, or Korean, the limit is 1,333 characters. Reference: https://help.salesforce.com/s/articleView?id=sf.approvals_processing_approval_requests_parent.htm&type=5

Salesforce Fact #480 | Inner query in trigger

Image
Suppose we have a use case where we need to check when an account record is updated, if it has at least one of each related contacts, opportunities and cases. We can use inner query to get the related records list and check the same instead of doing separate queries on each of the objects. Attached is the screenshot.

Salesforce Fact #479 | Required setting for checkbox field

Do you know, Checkbox fields cannot be made required neither from page layout nor from the field level settings.  Since, it is a boolean field which can have value either true/false, required is not supported to allow the false/unchecked value.

Salesforce Fact #478 | Add translator in translation workbench

Image
We can add translators for particular languages to enable users to add the translation for that language in translation workbench. The prerequisite permission is View Setup & Configuration which needs to be assigned to the user. To add users as translators, Go to Setup -> Translation Language Settings -> Click edit for the particular language -> Add users as the translators. Once assigned as the translator, the user is able to add the translation for that language only. For more details, check out:  https://help.salesforce.com/s/articleView?id=sf.adding_and_editing_translated_languages.htm&type=5 Attached are the screenshots.

Salesforce Fact #477 | Report filter with comma

Image
Report filter with comma is a bit tricky. If the search text itself contains the comma, then we need to wrap it inside double quotation marks to indicate that it is part of the search text and not a separator between values. Reference:  https://help.salesforce.com/s/articleView?id=000323721&type=1   Attached are the screenshots.

Salesforce Fact #476 | New generate manifest command

Image
With Summer'22 release, now it is very easy to create the manifest or package.xml file with multiple metadata members in VS Code. Now, we can select the particular components from the explorer and use the command SFDX: Generate Manifest File. It creates the manifest file with the selected components which we can use for deploying or retrieve metadata to or from org. Reference:  https://developer.salesforce.com/blogs/2022/05/learn-moar-in-summer-22-with-developer-tooling?_ga=2.117356678.1030199679.1658653219-201824057.1653640616   Attached are the screenshots.

Salesforce Fact #475 | Retrieve custom label from org

While retrieving custom label from org, if we specify particular ones in the members tag then the metadata type name is CustomLabel. For example,     <types>         <members>Input_Message</members>         <members>AccountType</members>         <name>CustomLabel</name>     </types> But while retrieving all the custom labels from the org, the metadata type name can be either CustomLabel or CustomLabels. Like this,     <types>         <members>*</members>         <name>CustomLabel</name>     </types> OR     <types>         <members>*</members>         <name>CustomLabels</name>     </types>

Salesforce Fact #474 | New rename component command for LWC

Image
With Summer'22 release, we now have a new rename component command for LWC. Previously, in order to update a LWC bundle we needed to rename each of the html, js and css file which was time-taking. Now, with a single rename command i.e. SFDX: Rename Component, all the components inside the bundle would get renamed. Note: However, the existing references of the old component names are not updated. So, we need to be careful. Reference:  https://developer.salesforce.com/blogs/2022/05/learn-moar-in-summer-22-with-developer-tooling?_ga=2.117356678.1030199679.1658653219-201824057.1653640616 Attached are the screenshots.

Salesforce Fact #473 | Restrict account create/update for all users

Image
Suppose we need to disable the account create and update access for the entire org for a particular course of time. We can make use of hierarchical custom settings and validation rule to implement this. We can create a hierarchical custom settings with a checkbox field and set it to true in the organization level. Then, use that value in the validation rule. Once the freeze period is over, we can set the flag to false in custom settings. Attached are the screenshots. Note: The profile and user level custom settings records need to be disabled/removed in order to ensure the org level value is considered.

Salesforce Fact #472 | Discard single/double quotes using validation rule

Image
Suppose we have a use case where we would not accept any single or double quote in the Account Name. We can implement the same using a validation rule. Attached is the screenshot.

Salesforce Fact #471 | Get map value using 15 digit record Id

Image
While using a Map having key as 18 digit record Id and value as the Sobject record, we can get the same record by passing the 15 digit recordId to the get method. Attached are the screenshots.

Salesforce Fact #470 | Entity links & hyperlinks in chatter post

Salesforce supports hyperlinks and entity links, but only hyperlinks are searchable.  An entity link is a user at-mention or a record slash-mention. An easy way to tell if a link is a hyperlink or entity link is to hover over the link in a post. If a hover card pops up with details about the user or record, then it’s an entity link. If there’s no hover card but instead a tooltip with the link url, then it’s a hyperlink. Help doc reference:  help.salesforce.com/s/articleView?id=sf.collab_feed_slashrecord.htm&type=5

Salesforce Fact #469 | Show & in screen flow picklist choice label

Image
While using Choice type resource in screen flow for a picklist, if we are using a choice label which contains '&' symbol then that is shown as '&amp;' In order to fix this, we can create a variable of text type and store the value in that variable and use that variable in the choice label. Attached are the screenshots.

Salesforce Fact #468 | Save row count with built-in custom metadata methods

Image
While using built-in custom metadata methods, it not only saves the SOQL query count. It does not count towards the SOQL row count as well. So it is quite efficient. Attached are the screenshots.  

Salesforce Fact #467 | Delete related contacts/opportunities using screen flow

Image
Many times we need to delete all the related records for a parent record. For example, we would like to delete all the related contacts or related opportunities for an account. Why not have a screen flow to get this done efficiently? We can create a screen flow which will ask for whether related opportunities or related contacts need to be deleted and based on the choice selected can perform the deletion. Attached are the screenshots. Note: The flow can be improved by adding the option to delete both the related contacts and opportunities and also by adding error handling.

Salesforce Fact #466 | Don't add translation for custom labels used in VR

Image
If we are using some custom label which is holding some string value and it is getting used in the validation rule, then we should not add any translation for that custom label otherwise the validation rule may break. For example, we want the user to restrict saving an account when type has a particular value and that value is stored in the custom label so that it can configured as and when needed. Now, the validation rule is fine as long as there is no translation added. Once, we add the translation for a particular language and a user with that particular language tries to save an account with the same type, the validation rule is not fired since instead of the English text it takes the translated value of that particular language. So, we need to be careful. Attached are the screenshots.

Salesforce Fact #465 | Activate translation using file import

Image
In continuation of the last post, let's see how we can change an out of date translation back to current one again. For this, we need to export the the translations. To export the translations, go to Setup -> in quick find, search for Export -> Select export type as Bilingual and click on Export as STF. Now, you will receive an email once the export is completed and you can download the files. It is basically a zip file with all the translated and untranslated texts for each of the active languages. In the file, The Out of Date indicators are: An asterisk (*): The label is out of date. A change was made to the default language label and the translation hasn't been updated. A dash (-): The translation is current. In this example, we have a custom field label translation i.e. VerificationStatus1 which is outdated. Now we would make it current by changing the indicator to dash(-) again. And finally, we need to import the file. Before importing, we need to ensure there is no