Showing posts with label Workflows. Show all posts
Showing posts with label Workflows. Show all posts

Friday, April 1, 2011

Making Notes non-editable after X hours

Recently, there was a requirement from my client that they wanted to ensure that the notes for all the entities be made non-editable after 8 hours from the time the note was created for a specific set of users with say "Salesperson" role.
After some thinking, I came up with the below idea.

1. I gave the "Salesperson" role only User level Write access on the Note entity.
2. Then I created the below workflow on the Note entity :


3. For demo purposes, I wait for only 1 minute after a note is created but you make it wait for as long as you need.
4. As you can see above, I check if the created by is someone other than Administrator. I then wait for a minute and then update the owner of the Note to Administrator.
5. Since a Salesperson has only User level Write access, when he tries to edit this note, he will get an error saying that he does not have sufficient privileges.

Cheers,
Srihari