function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Nikita Ghosh 19Nikita Ghosh 19 

Validation Error with the Picklist value is not working.

I need a validation rule:

There is a Status field and if Status = Valid AOC than there should be an specific date that should be update in to AOC Expiry Date (Ther is a default value in the AOC Expiry Date, which is 31/12/2016) If the default value is not changed than there should be an error to update a valid date.   
I am using this formula: 
NOT( AND( ISCHANGED( AOC_Expiry_Date__c ),
 ISPICKVAL( Status__c , 'Valid AOC')  ) )

Formula is working good but after changing the date, still I am facing the error. 
SalesFORCE_enFORCErSalesFORCE_enFORCEr
It should be like this:
AND( NOT(ISCHANGED( AOC_Expiry_Date__c )),
 ISPICKVAL( Status__c , 'Valid AOC'))
Nikita Ghosh 19Nikita Ghosh 19
Hi 

I tried this bt i m still facing the error. 

Thanks.
SalesFORCE_enFORCErSalesFORCE_enFORCEr
Above formula will throw an error if, AOC_Expiry_Date__c is not changed and Status__c is Valid AOC. Is that what you want?
Nikita Ghosh 19Nikita Ghosh 19
No, I want a error if AOC_Expiry_Date__c dont change from its default date. I want user add expiry date if they are changing the status to Valid AOC. As AOC_Expiry_Date__c has a default value that should be change once the status = Valid AOC 
Nikita Ghosh 19Nikita Ghosh 19
It is throwing the error perfectly but after changing the date the error is still staying there.
SalesFORCE_enFORCErSalesFORCE_enFORCEr
AND(
NOT(ISCHANGED( AOC_Expiry_Date__c )),
AOC_Expiry_Date__c = 'Give the default date value',
ISCHANGED(Status__c ),
ISPICKVAL( Status__c , 'Valid AOC')
)

This will fire if Status__c is changed to Valid AOC and the AOC_Expiry_Date__c is not changed and AOC_Expiry_Date__c  is equal to default date value.
SalesFORCE_enFORCErSalesFORCE_enFORCEr
Did you click on Save after changing the date?
Nikita Ghosh 19Nikita Ghosh 19
Yes on the early one, One before this.
 
SalesFORCE_enFORCErSalesFORCE_enFORCEr
Change of date will make the first criteria false hence validation will pass. Are you sure that you did it exactly as mentioned.
Nikita Ghosh 19Nikita Ghosh 19
This formula is not working at all, it is throwing error wile saving the formula.
AND(
NOT(ISCHANGED( AOC_Expiry_Date__c )),
AOC_Expiry_Date__c = 'Give the default date value',
ISCHANGED(Status__c ),
ISPICKVAL( Status__c , 'Valid AOC')
)

This formula works 
AND( NOT(ISCHANGED( AOC_Expiry_Date__c )),
 ISPICKVAL( Status__c , 'Valid AOC'))

But error mess stay as it is while changing the date.
SalesFORCE_enFORCErSalesFORCE_enFORCEr
Working for me. When I set the status to Valid AOC and donlt change the date then i get the error. 
Nikita Ghosh 19Nikita Ghosh 19
yes true. But after changing the date it still throw the error. 
SalesFORCE_enFORCErSalesFORCE_enFORCEr
what is the new date value? and when you change the date what is the status value?
Nikita Ghosh 19Nikita Ghosh 19
new date value i put any random suppose for tomorrow and status value is the same 'Valid AOC '
SalesFORCE_enFORCErSalesFORCE_enFORCEr
can you share the screeshots of the validation rule, your record with the error?
Nikita Ghosh 19Nikita Ghosh 19
This is the formula
User-added image
This is the record before error

User-added image

After hitting the save button this is the outcome

User-added image

After changing the date the error remain there as it is.

User-added image

I am leaving for home, I will reply you in 45 minutes. Thanks for all the effort doing for me. 
 
SalesFORCE_enFORCErSalesFORCE_enFORCEr
Can you check the field values in the debug for validation rule? 
SalesFORCE_enFORCErSalesFORCE_enFORCEr
Also, please make sure there isn;t any other validation with the same error message.
Nikita Ghosh 19Nikita Ghosh 19
Yes, I checked it very care fully there is no other validation with the same error message.