Hello, friends today we will see how we can write a validation rule that will allow the record to be edit only in the created week where:
Week First Day: Sunday
Week Last Day: Saturday
Validation Rule:
NOT(ISNULL(CreatedDate))&&IF(CASE(MOD(DATEVALUE(CreatedDate)-DATE(1900, 1, 6), 7),
0, IF((TODAY()<(DATEVALUE(CreatedDate) + 0)),”true”,”false”),
1, IF((TODAY()<(DATEVALUE(CreatedDate) + 6)),”true”,”false”),
2, IF((TODAY()<(DATEVALUE(CreatedDate) + 5)),”true”,”false”),
3, IF((TODAY()<(DATEVALUE(CreatedDate) + 4)),”true”,”false”),
4, IF((TODAY()<(DATEVALUE(CreatedDate) + 3)),”true”,”false”),
5, IF((TODAY()<(DATEVALUE(CreatedDate) + 2)),”true”,”false”),
6, IF((TODAY()<(DATEVALUE(CreatedDate) + 1)),”true”,”false”),
“false”)
=”true”,false,true)
I hope it will be helpful for you guys. If there is any err or change you want to suggest then tell me in comments.
Leave a comment