You need to sign in to do that
Don't have an account?
Using priorvalue on validation rule
Hi,
I'm trying to create a validation rule that looks at a picklist field and return an error if the value has been changed after the record is approved.
The field contains 4 selections: 14, 30, 45 and 60.
What I'm trying to achieve is a validation rule that if a user (originally created the record with 14 as the selection) was to change it to 30, then they would get an error message "you can not change after approval".
When I try using the priorvalue, it says that this function can not be used in this type of formula.
I tried changing it to use TEXT values i.e.
(TEXT(Payment_Date__c) != TEXT(PRIORVALUE(Payment_Date__c)))
However this doesn't return the error message even I'm able to save the validation rule.
Does anyone know how to achieve using priorvalue for picklists? What is the best method for this?
All Answers
This will flag error message only for updated record, where previous value was 14.
Mark this as Best Answer, if this solves your problem.
Correct if i am wrong, but my understanding of:
ISCHANGED(fieldname__c) && status__c = 'Approved'
is as follows:
ISCHANGED(fieldname__c) -> Checks if the field has been updates, return true if changed/updated.
fieldname__c (status__c) = 'Approved' -> Checks if the field's current value is 'Approved' or 14 (as per Question detail)
That means error will be flagged if the record is updated and current value of fieldname__c is 14/Approved.
But the question description says that error message should be flagged if previous value of fieldname__c was 14/Approved and current value is something else (anything except 14/Approved).