Posts

Showing posts with the label check

Salesforce Fact #881 | Community user check using ContactId on User

Image
We can make use of ContactId field in User object to identify if the current logged in user is a community user or not. The same can be used in LWC. Attached is the screenshot. Note: The ContactId field cannot be updated manually and while trying to do so, the below error is encountered: 'You can't create a contact for this user because the org doesn't have the necessary permissions. Contact Salesforce Customer Support for help.'

Salesforce Fact #824 | Simplifed check in validation rule

Suppose we have a use case in validation rule, where we need to restrict the change of some fields for all persona and if the user has a particular custom permission set assignment then the validation stays the same except for one field. So, instead of repeating the condition check we can simplify the condition since few of the fields are anyways common: OR( ISCHANGED(AccountNumber), ISCHANGED(AnnualRevenue), IF(NOT $Permission.Test_Custom_Perm, ISCHANGED(NumberOfEmployees), FALSE) ) In the above example, the user is restricted to update Account number, Annual Revenue and Numberofemployees fields with the exception for  NumberOfEmployees if the user is assigned the  Test_Custom_Perm custom permission.

Salesforce Fact #685 | Record lock check in flow

Image
We can create an Invocable method to check whether a record is locked or not. It is useful whenever we need to check the same in flow. Attached is the screenshot.