Posts

Salesforce Fact #953 | Limit error in Get Records while using IN operator

Image
We need to be careful while using the IN operator in Get Records element in record-triggered flow. If the text collection is empty, it seems Salesforce runs a query to fetch all the records of that sobject and the number of query rows are counted in the governor limit. So, if the total number of records for that sobject is more than 50000, it throws limit error. Fix would be to always check if the collection is empty or not, before using it in the IN operation. In this example, varIds is an empty text collection used in IN operation to fetch the account records. However, the number of query rows returned is 136 instead of 0, which is the total number of account records in the org. Attached are the screenshots.

Salesforce Fact #952 | Delete debug level

Steps to delete debug level: Go to classic -> setup -> Under Monitor -> Logs -> Debug levels -> select the debug level -> delete. Reference:  https://stackoverflow.com/questions/73911362/salesforce-debug-levels-need-to-edit-or-delete-existing-level

Salesforce Fact #951 | Sum of value of selected records in screen flow datatable

Image
Suppose we have a datatable in screen flow and we would like to show the sum of some numeric field of the selected records. We can use screen action and transform element to get the results. In this example, we are getting the sum of the Numberofemployees of the selected account records. Attached are the screenshots.

Salesforce Fact #950 | Restricted profile cloning in action

We can use the Restricted Profile Cloning setting to avoid exposing permissions in cloned profiles. For example, suppose we have enabled field service in the org and provided CRED access to Work Order object in a profile. Now, for some reason FSL is disabled in the org. Now, profile is cloned and after cloning, the FSL is again enabled in the org. If Restricted profile cloning is enabled, the Work Order object would have no access in the cloned profile. Steps to enable : Setup -> User Management Settings -> enable the toggle for Restricted Profile Cloning. Reference:  https://help.salesforce.com/s/articleView?id=platform.users_restricted_profile_cloning.htm&type=5

Salesforce Fact #949 | If-else statement in lightning email template

Image
We can add if/else condition in Lightning Email template to some extent. In this example, We are showing the Account rating in the template if the parent account is present. Reference:  https://trailhead.salesforce.com/trailblazer-community/feed/0D54V00007ifdqr Attached is the screenshot.

Salesforce Fact #948 | Prevent login using Transaction Security Policy

Image
We can use transaction security policy to prevent multiple users from logging into Salesforce. To implement this, we use the LoginEvent, an apex class and custom permission set. In this example, we have created a permission set 'Prevent Login PS' and in the apex class we are checking whether the user is assigned the PS or not. Note: Custom permission check does not work because in that case the context user is Automated user, not the intended user. Reference:  https://salesforce.stackexchange.com/questions/387530/featuremanagement-checkpermission-not-returning-expected-result Attached are the screenshots.