Professional Documents
Culture Documents
For example, if the stage is "Prospecting" or "Qualification," the probability must be different from 10%.
Similarly, for stages like "Needs Analysis" or "Proposal/Price Quote," the probability should not be 25%.
By implementing this validation rule, data integrity is maintained, preventing data inconsistencies and
providing accurate insights into sales pipeline management.
Error Message: A contact with the same email address already exists.
Explanation: This compound validation rule tackles the challenge of preventing duplicate contacts based on
the email address field. It checks if the Email field is not blank, if it's a new record, and if the Email field value
already exists in another contact record.
By leveraging the ISDUPLICATEVALUE function, Salesforce compares the Email field value with
existing contacts and triggers the validation rule when a duplicate email is detected.
Implementing this validation rule helps maintain a clean and accurate contact database, preventing duplicate
entries and streamlining communication and relationship management
Note: The ISDUPLICATEVALUE function requires enabling Duplicate Management in Salesforce to
work properly.
Formula:
AND(
ISPICKVAL(StageName, "Closed Won"),
ISCHANGED(Discount_Percentage__c),
Discount_Percentage__c > 0.2
)
Explanation: In this scenario, we want to enforce a validation rule that restricts the discount percentage on
opportunities. The rule applies when the opportunity reaches the "Closed Won" stage and the discount
percentage is modified. The formula checks if the Discount_Percentage__c field is greater than 0.2 (or 20%).
If the condition evaluates to true, the validation rule triggers an error, preventing the opportunity from being
saved. This helps maintain pricing integrity and prevents excessive discounting. 💰🔒
Scenario 4: Complex Validation Rule for Contact Duplicate Prevention (Contact Details Prevention
Rule)
Scenario: Preventing Duplicate Contacts based on Email and Phone
Formula:
AND(
OR(
ISCHANGED(Email),
ISCHANGED(Phone)
),
ISNEW(),
OR(
ISBLANK(Email),
ISBLANK(Phone),
NOT(ISNULLVALUE(Email)),
NOT(ISNULLVALUE(Phone))
),
OR(
ISNEW(),
NOT(CONTAINS(Email, LEFT(Phone, 3)))
),
OR(