0

The validation rule I have right now stops reps from changing the date if the meeting has been completed, indicated by a checkbox.

AND(
Meeting_Conducted__c = TRUE,
ISCHANGED( Meeting_Date__c ))

But I am missing one piece. The rule should allow for reps to updatethe Meeting_Date__c if it is in the SAME MONTH as the original value. Once the month has passed, reps should not be allowed to update that field... Any ideas? I thought it would be:

MONTH(Meeting_Date__c) != MONTH(Meeting_Date__c)

I am trying to add the Month check to the existing rule. When I say it doesn't work, I mean the SFDC doesn't even register that line in the rule.

I've also tried doing something like:

AND(
Meeting_Conducted__c = TRUE,
ISCHANGED( Meeting_Date__c ),
TEXT(MONTH(Meeting_Date__c )) != TEXT(PRIORVALUE(Meeting_Date__c )))

Have also tried:

Meeting_Conducted__c = TRUE
&&
ISCHANGED( Meeting_Date__c )
&&
NOT(
MONTH(Meeting_Date__c) >= MONTH(TODAY())
&&
YEAR(Meeting_Date__c) = YEAR(TODAY()))
New contributor
Amanda is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
2
  • 2
    Welcome to Salesforce Stack Exchange (SFSE)! What do you mean by "it doesn't work?" Is there a syntax error, does it only validate for certain entries (if so, please give specific examples of when it works and when it doesn't)? Can you always change it? Can you never change it?
    – Moonpie
    Jan 14 at 1:47
  • 2
    And please clarify: are you replacing the existing validation rule formula with the one you tried, or adding the MONTH check to the existing? If you are adding it, please show the exact final formula that you tried. (FYI: Rather than answer in comments, please edit your question to answer any questions posed in comments or to add additional information that you think of. Many people add UPDATE or EDIT at the bottom and add info below.)
    – Moonpie
    Jan 14 at 1:54
0

Your first attempt did not work because...

MONTH(Meeting_Date__c) != MONTH(Meeting_Date__c)

...will always be FALSE, as it is comparing the current value to itself.

It seems that you discovered that, and so changed it to use PRIORVALUE. You were very close, but you changed more that one "variable" at a time in your experiment: There is no need to change the MONTH TO TEXT in this context, so this will work:

MONTH(PRIORVALUE(Meeting_Date__c)) != MONTH(Meeting_Date__c)

Also:

  • You do not need to add the = TRUE to the logic for the Meeting_Conducted__c checkbox - it is a Boolean, so you can just use Meeting_Conducted__c to check for TRUE and NOT(Meeting_Conducted__c) to check for FALSE.
  • If you are explicity checking for a changed MONTH (or DAY or YEAR for that matter), you do not need the ISCHANGED() check any more.

Validation Rule

AND(
  Meeting_Conducted__c,
  MONTH(PRIORVALUE(Meeting_Date__c)) != MONTH(Meeting_Date__c)
)

Using the above rule, then starting with the following data...

enter image description here

...when I tried to change the MONTH, this happened:

enter image description here

...and when I tried to only change the DAY, it was accepted:

enter image description here

When Meeting_Conducted__c was not checked, I was able to change the MONTH, DAY and YEAR to my heart's content.


NOTE that you will probably want to add a check for the YEAR, as the Validation Rule I posted does not and the user can change the YEAR with it.

Your Answer

Amanda is a new contributor. Be nice, and check out our Code of Conduct.

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.