#trailhead #salesforce #salestraining Add Business Logic to a Travel Approval App : • Add Business Logic to a Travel Approval App Salesforce Trailhead Create Validation Rules Let’s start with validation rules. Validation rules let you set up business-specific criteria to prevent users from saving invalid data in one or more fields. A validation rule evaluates a formula when a record is saved. If a rule’s criteria aren’t met, users see a custom error message and the record doesn’t save. If a rule’s criteria are met, the record saves. Use validation rules to improve data quality by applying conditions, ensuring proper formatting, and enforcing consistency. Let’s create a validation rule to enforce that a trip end date must always be greater than the trip start date. Click Setupand select Setup. Click Object Manager and then click the Down arrow icon. This provides a list of recent objects you’ve edited.Object Manager with recent records displayed. Select Travel Approval to open the configuration page for the Travel Approval object. Click Validation Rules. Click New. The Travel Approval Validation rule configuration window Enter the following values. Parameter Value Rule Name Trip end date after start date Active Make sure to keep this selected/checked. Condition Formula NOTE: When writing a validation rule, your condition formula should return “true” for your error condition. Error Message Trip end date must be greater than or equal to start date Error Location Select Field and pick Trip End Date as the location for the error Here's what the rule should look like. The Travel Approval Validation rule configuration window with values 7. If everything looks good, click Save. 8. Next, click the Back to Travel Approval link. 00:00 Introduction 01:43 Object 02:51 Validation Rule