Salesforce Admin – Validation Rules Questions

Validation rules are a powerful tool for enforcing business logic and data quality in Salesforce. These questions cover the fundamentals of validation rules, error message placement, differences from required fields, and real-world implementation examples. Understanding validation rules is essential for maintaining data integrity and guiding users through proper data entry processes.

Validation Rules - Q&A

  1. Q1. What is a Validation Rule in Salesforce and why do we use it?
    Ans: Validation Rules enforce business logic by preventing users from saving invalid data. They use formulas to evaluate conditions and display error messages when criteria aren't met.
  2. Q2. Can you give a real-time example of a Validation Rule?
    Ans: Yes, for example: If a user tries to close an Opportunity without entering the 'Close Date', we can create a validation rule like: AND(ISPICKVAL(StageName, 'Closed Won'), ISBLANK(CloseDate)) This ensures that critical data is captured before progressing stages.
  3. Q3. Where can we show validation error messages?
    Ans: Error messages can be shown either at the top of the page or next to a specific field, depending on how we configure the rule.
  4. Q4. How are Validation Rules different from Required Fields?
    Ans: Required fields are enforced at field-level or page layout-level, and are always triggered. Validation rules offer conditional enforcement based on formulas — so they're more flexible and powerful for complex logic.
  5. Q5. Do Validation Rules run on system-generated updates like workflows or flows?
    Ans: No, validation rules don't trigger on workflow field updates or processes. They only apply during user-driven DML actions like create or update, unless the flow is screen-based.
  6. Q6. What happens to existing data when a new Validation Rule is created?
    Ans: Validation rules only apply to new or updated records. Existing records are not impacted unless you attempt to edit and save them after the rule is active.
  7. Q7. Validation: Contact's email must be from a specific domain (@company.com)
    Ans: In one of my projects, we restricted contact emails to internal domains. Here's the rule: NOT(CONTAINS(Email, "@company.com")) It ensures only company email addresses are used on Contact records.
  8. Q8. Validation: Prevent Opportunity from being marked 'Closed Won' if Amount is less than ₹10,000
    Ans: To avoid revenue leakage, we used: AND(ISPICKVAL(StageName, "Closed Won"), Amount < 10000) This enforces a minimum value before closing a deal.
  9. Q9. Validation: Ensure Phone number is exactly 10 digits
    Ans: We needed consistent formatting for phone fields, so we used: OR(LEN(Phone) <> 10, NOT(ISNUMBER(Phone))) This checks both length and numeric format.
  10. Q10. Validation: Prevent Case closure without entering Resolution Description
    Ans: To maintain customer support quality, we had: AND(ISPICKVAL(Status, "Closed"), ISBLANK(Resolution__c)) This ensures that agents provide a resolution before closing the case.
  11. Q11. Validation: Block changing Account Type to 'Customer' if Industry is blank
    Ans: This enforces data quality by ensuring that when an Account is marked as a 'Customer', we have industry information: AND(ISPICKVAL(Type, "Customer"), ISBLANK(Industry))

Back to Admin Home