I just had a task for a client, in which I had to create a Validation Rule, and that Validation had to do the following:
- On the current Account Record, (It can be Account, Opportunity, Contact etc.)
- If the CreatedDate was last Month then the user can not edit the record but if it was not then the user can edit the record.
- First thing was, I had to convert CreatedDate to a regular Date value because it was a DateTime Value. So you do that by DATEVALUE(CreatedDate).
- Then I stated that if the year of the CreatedDate and Month is not equal to today then basically spit out an error. This is the complete Validation Rule:
YEAR(DATEVALUE(CreatedDate)) <> YEAR(TODAY()),
MONTH(DATEVALUE(CreatedDate)) <> MONTH(TODAY())
)
I hope this helps... Let me know send me feedback..
Thanks
View my Other Blogs:
VisualForce Made Easy
Salesforce Data Migration Made Easy
No comments:
Post a Comment