Skip to main content

#Salesforce Admin #Opportunity #Validation RuleHow would you create a Validation Rule that prevents an Opportunity from moving to Closed Won unless the Amount and Close Date fields are populated, and how would you test it?

1 risposta
  1. 17 ott, 17:30

    Hi @Rakesh Goud  You can achieve this using a Validation Rule on the Opportunity object.

    Steps:

    1. Go to Setup → Object Manager → Opportunity.
    2. Select Validation Rules → New.
    3. Enter a rule name, such as Require_Fields_For_Closed_Won.
    4. Add the following formula:

    AND(

    ISPICKVAL(StageName, "Closed Won"),

    OR(

    ISBLANK(Amount),

    ISBLANK(CloseDate)

    )

    )

    Add an error message: "Please enter Amount and Close Date before closing the Opportunity."

    1. Save and activate the rule.

    How to Test:

    • Set Stage to Closed Won and leave Amount blank → Validation error.
    • Enter Amount but leave Close Date blank → Validation error.
    • Enter both fields and select Closed Won → Record saves successfully.
    • Select another stage → This validation rule does not block the save.

    Important: In standard Salesforce, Close Date is already a required Opportunity field, so you generally cannot leave it blank. Also, this formula validates every save while the Opportunity is Closed Won, not just the initial stage change.

    Useful Salesforce Documentation:

    Hope this helps!

0/9000