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
s_rubdis_rubdi 

Validation Rule to Lock a Task Record based on Date

Business Requirement:

 

Lock records from editing if they are > 2 weeks old.

 

Proposed Solution:

 

Develop a validation rule that prevents a non-system administrator end user from editing a record > 14 days old.

 

Error Condition Formula:

 

AND 

TODAY() - (DATEVALUE(CreatedDate)) > 14 , 
NOT( $Profile.Id ="00e3000000xxxx") 
)

Best Answer chosen by Admin (Salesforce Developers) 
JitendraJitendra

Validation rule will work just fine. Instead of hardcoding profile ID you can use "$Profile.Name".

All Answers

Suresh RaghuramSuresh Raghuram

Instead hardcoing the Id value better to write a trigger where it is possible to have access to the profile with out giving hardcode values.

JitendraJitendra

Validation rule will work just fine. Instead of hardcoding profile ID you can use "$Profile.Name".

This was selected as the best answer
s_rubdis_rubdi

Understood - thank you!

s_rubdis_rubdi

Thank you Suree!