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
Paula Jarvis 4Paula Jarvis 4 

How do I lock down two date fields?

I have two date fields that track warranty start date and warranty end date. I need to lock these down once they have a value and allow three specific Profiles the ability to edit if necessary. This is what I have so far and it works but I am not referencing the second field (Warranty End date). Thank you for your assistance!

AND(
NOT(ISBLANK(PRIORVALUE( PBSI__Waranty_Start_Date__c ))),
ISCHANGED( PBSI__Waranty_Start_Date__c ),
$Profile.Name <> "Custom Finance",
$Profile.Name <> "Custom Billing Administrator",
$Profile.Name <> "System Administrator")
Maharajan CMaharajan C
Hi Paula,

Try the below formula:

AND(
OR(NOT(ISBLANK(PRIORVALUE( PBSI__Waranty_Start_Date__c ))),NOT(ISBLANK(PRIORVALUE( PBSI__Waranty_End_Date__c )))),
OR(ISCHANGED( PBSI__Waranty_Start_Date__c),ISCHANGED( PBSI__Waranty_End_Date__c)),
$Profile.Name <> "Custom Finance",
$Profile.Name <> "Custom Billing Administrator",
$Profile.Name <> "System Administrator")

Can you please Let me know if it works or not and also If you face any problems!!!

If it works don't forget to mark this as a best answer!!!

Thanks,
​Raj
Paula Jarvis 4Paula Jarvis 4

Hello Maharaja,

The fields are not locking down. Users are still able to change them. Is there prior value logic that can be included to revert the dates back if they change?

Thank you!

Maharajan CMaharajan C
Ok Don't Include the ISCHANGED function in formula:

The formula is working fine to me against your requirment in mydev org:

AND(
OR(NOT(ISBLANK(PRIORVALUE( PBSI__Waranty_Start_Date__c ))),NOT(ISBLANK(PRIORVALUE( PBSI__Waranty_End_Date__c )))),
$Profile.Name <> "Custom Finance",
$Profile.Name <> "Custom Billing Administrator",
$Profile.Name <> "System Administrator")

If you include the ISCHANGED function you can edit the field but you can't the change the value on the field then if you don't include the ISCHANGED function simply you can't edit also.

And just to be clear:

The above validation no need to fire for intial values are filled in record i.e when it is changed from null to values?

And Only it is need to fire in the second time after the value entered by anyone in field right except the three profile? 

And one more suggestion If you dont want to allow any users to enter the value except the three profile then remove the PRIORVALUE function line in formula but keep the ISCHANGED function. 

Can you please Let me know if it works or not and also If you face any problems!!!

If it works don't forget to mark this as a best answer!!!

Thanks,
​Raj