Posts

Showing posts with the label validation

Salesforce Fact #889 | Validation on address input parts in screen flow

Image
We can set the Required option to TRUE for the Address type input in screen flow. But that would make all the address components to be required. Suppose, we want to keep a validation such that when the state is selected the user should also provide the city in the input. For this, we can make use of the validate input option. 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:

Salesforce Fact #822 | Validation on case closure

Image
Suppose we want to add a validation that a case can only be closed if the current user is the owner or he is part of the owner queue. We can check the current user id against the owner id or if there is a row present in GroupMember object for this user. The validation be implemented in record-triggered flow using the custom error component. Attached are the screenshots.

Salesforce Fact #736 | Instant success/error message on password re-enter

Image
We can show instant success/error message in the scenario of re-enter password validation in screenflow. This can be done using component visibility on two Display Text inputs. Note: This is not dependent on the reactive screen beta feature. Attached are the screenshots.

Salesforce Fact #640 | At least one line item

Image
Suppose once an opportunity is added with a related opportunity line item, it needs to have at least one line item from then on. We cannot delete all the related line items. We can implement the same using the HasOpportunityLineItem field in a validation rule. Attached is the screenshot.

Salesforce Fact #634 | Validation on opportunity deletion

Image
Suppose we need to keep a validation on Opportunity, an opportunity cannot be deleted if it has existing line items. We can make use of the HasOpportunityLineItem field in trigger. Attached is the screenshot. Note: The code snippet is only for demonstration purpose and apex best practices have not been covered.

Salesforce Fact #628 | Related account industry validation using trigger

Image
Suppose we have a scenario where we need to put a validation such that the industry of the related account should be the same on contact. If we update the related account on contact record, it needs to be of the same industry. This can be implemented using trigger logic. Attached is the screenshot. Note: The code snippet is only for demonstration purpose and coding best practices have not been covered.

Salesforce Fact #621 | Restrict owner update in case of manual sharing records

Image
In context of the last post, suppose we want to put a validation that if the account records have existing manual sharing records then the owner cannot be changed. We can implement the same using trigger logic. Attached is the screenshot. Note: The code snippet is only for demonstration purpose and coding best practices have not been covered.

Salesforce Fact #581 | LWC datatable validation on row selection

Image
Suppose we have a scenario where we have a lightning datatable in lwc with couple of columns. Now, if the user selects any record where any of the column value is not present, an error message needs to be shown. We can implement this with some JS logic. In this example, the datatable shows contact fields and if any of the Phone or Email is empty of the selected records, it shows an error message. Attached are the screenshots.

Salesforce Fact #244 | Password retype validation in screen flow

Image
Re-enter password is a common feature while signing up or filling up a form. We can also implement the same in screen flow using password type component and validate input option.  Attached are the screenshots.