0

When closing an opportunity (won) I would like to get an error if close date is NOT greater than 30 days

It does not seems to be working, when I try to save the record it save successfully even though my close date is not greater than 30 days.

Any ideas?

AND(
OR (
 ISPICKVAL(StageName, "Closed Won")
),
CloseDate > TODAY() + 30)
)
3
  • You say "I would like to get an error if close date is greater than 30 days" but also "[the record] save successfully even though my close date is not greater than 30 days." Those appear to be opposite of one another. Can you please edit to clarify?
    – David Reed
    Commented Jun 26, 2021 at 1:44
  • This formula is also not valid - the parentheses are not balanced. Please share viable code.
    – David Reed
    Commented Jun 26, 2021 at 1:45
  • sorry typo I meant if the close date is not greater than 30 days, update the question.
    – Nick
    Commented Jun 26, 2021 at 1:46

1 Answer 1

1

The formula should evaluate to true to give an error. So ideally, you should check if the CloseDate<Today() +30

Also you don't need the OR condition.

See below formula:

AND(
 ISCHANGED(StageName),
 ISPICKVAL(StageName, "Closed Won"),
 CloseDate < TODAY() + 30
)
2
  • 1
    Also worth noting that this will block all edits to Closed Won opps, which is probably not what is actually desired (if not stated!) I would add an ISCHANGED() check.
    – David Reed
    Commented Jun 26, 2021 at 1:50
  • 1
    Agreed, so added a ISCHANGED() check only for Stage as of now(for example). But would also depend on how future edits need to be handled, if edit to Closed Won opportunities are allowed. Accordingly ClosedDate/ModifiedDate needs to be checked Commented Jun 26, 2021 at 2:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .