Skip to main content The new Salesforce certifications experience is live! Visit Trailhead Academy to explore your new certifications homepage.

I have a validation rule below that I'm trying to understand/work the PRIORVALUE function into. This is the validation rule:

AND(

 

NOT(ISBLANK(JournalsAssigned__c)),

 

NOT(ISBLANK(JournalLimit__c)),

 

JournalsAssigned__c > JournalLimit__c

 

)

 

My issue with the validation rule right now is that it doesn't trigger soon enough. Each Individual under a Company has a "Journal Quantity" field. These are rolled up in a declarative rollup summary to the "Journals Assigned" field which cannot exceed the "Journal Limit" field. However, since it has to wait to "roll up", I'm able to save the "Journal Quantity" field with whatever values I want, even if it will end up exceeding the Journal Limit once it's rolled up. Then, when I try to do something else -- like create an affiliation or something, I get the validation rule error randomly. Someone else suggested working the PRIORVALUE function into my formula, which I'm not sure how to do and not sure I understand how that would resolve it. Any thoughts/guidance?

 

Thanks,

 

Amy

1 answer
  1. Feb 4, 2019, 1:15 PM
    Hi Amy,

     

    PRIORVALUE returns the value of a field before the save operation - and I don't see how that would help you here at all.

     

    However, this is all moot if your validation rule is on the parent object. Ths validation rule needs to apply to the child, to block the child from saving, rather than blocking the parent from counting it.

     

    So how about trying a validation rule on the child object that checks that the parents' JournalsAssigned__c >= JournalLimit? Notice that it's bigger OR EQUAL TO the limit, and not just bigger than.
0/9000