0

this validation rule should say "one of these three fields has changed AND Stage=Posted AND Close Date is before the current month" but it's still permitting edit of Stage, and I'm not sure the date piece is quite right. Can you help, and if so, can you also tell me what my formula is saying instead of the above, so I can learn?

AND(

OR (
ISNEW(),
ISCHANGED( CloseDate ),
ISCHANGED( StageName ),
ISCHANGED( Region__c )),

CloseDate < DATE( YEAR(TODAY()),
MONTH(TODAY()), 1),

ISPICKVAL(StageName,"Posted"))
2
  • 1
    It sounds like you're asking for the formula given in the examples titled Date Must Be in the Current Month
    – Mark Pond
    Commented Feb 14, 2022 at 21:11
  • edited for clarity: it's helpful but for it to fire the date has to be before the current month (among other things).
    – sna
    Commented Feb 15, 2022 at 21:45

1 Answer 1

0

If the Stage is currently "Posted", and you change it, then you no longer meet the criteria. I believe you're looking for the PRIORVALUE:

AND(
    OR (
        ISNEW(),
        ISCHANGED( CloseDate ),
        ISCHANGED( StageName ),
        ISCHANGED( Region__c )
    ),
    CloseDate < DATE( YEAR(TODAY()), MONTH(TODAY()), 1),
    ISPICKVAL(PRIORVALUE(StageName),"Posted")
)

You may also need PRIORVALUE on some of the other fields, too, based on your intent, but I tried to make as few assumptions as possible.

2
  • YES, thank you so much--initial testing says this works; I so appreciate your help! I thought the formula said "if it's 'Posted' and you try to change one of these three things with this date restriction, then fire the rule," so I'll have to learn more about the function of PRIORVALUE.
    – sna
    Commented Feb 14, 2022 at 23:15
  • oh arg, VR now works in every way except one: It should fire on ANY attempts at all to edit the Date. But it still permits a Date change if it's changed TO something in current or future month. Any ideas?
    – sna
    Commented Feb 15, 2022 at 21:47

You must log in to answer this question.

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