Posts

Showing posts with the label simplified

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 #814 | Simplified row returned check on SOQL

Image
With the advent of the new Null Coalescing operator, the row returned check from SOQL has also been simplified. Previously, if a query is expected to return one row and if it does not return any row we used List collection to avoid the error: 'List has no rows for assignment to SObject'. But now, with Null Coalescing operator we can check it using the sobject variable only, no need of List collection. Attached is the screenshot.