Posts

Showing posts from June, 2024

Salesforce Fact #851 | Test Suite in Apex test run

While dealing with code coverage coming from multiple test classes, Test Suite is a very helpful option. Using Test Suite, we can create a suite of multiple test classes as required and while checking the coverage we can simply run this suite instead of finding and running the test classes individually. To create a test suite: Go to Developer Console -> Test -> New Suite -> Enter a name for the suite -> Add the test classes from available to selected section -> save. To run a test suite:   Go to Developer Console -> Test -> New Suite Run -> Move the suite to selected test suites section -> Run suites. Reference:  https://help.salesforce.com/s/articleView?id=sf.code_dev_console_test_suites_creating.htm&type=5

Salesforce Fact #850 | Toggle active/inactive based on input number in screen flow

Image
Another example of screen flow reactive feature. Suppose, we would like to make a toggle active or inactive based on the number input by user. We can make use of screen flow reactivity. In this example, when the user enters number >=20 the toggle gets active. Attached are the screenshots.

Salesforce Fact #849 | Making field read only using dynamic forms and custom permission access

Image
Another use case of dynamic forms. Suppose, we want to make a field read only for all users and would like to make it editable only if the user is assigned a particular custom permission. We can make use of dynamic forms and take two instances of that field along with the filter conditions accordingly. In this example, we have made the LeadSource field on Opportunity read only for most users and editable only if the user is assigned the 'Test_Custom_Permission'. Note: Admin users will always see the field as editable because of the system permission 'edit read only fields'. Dynamic forms are not supported for community. Attached are the screenshots.

Salesforce Fact #848 | Trigger validation on locked records

Image
Suppose we want to put a validation that if an account record is locked, we cannot create any related record for example Contact. Attached is a sample trigger code: