Recently on a client project we ran into a scenario where they wanted users to be able to make a request to delete an item but not really delete the item. The user would make a request and then the administrator would come and either delete the document or keep it based on the needs. This got me thinking about how to make this easiest for the users. I decided to create a custom workflow and add a quick action to the item dropdown. This would make it seem simple to the user since they are used to this action for deleting items. Since the dropdown is already security trimmed they wouldn't see the standard delete so there would be no confusion with me adding my delete and using the same icon. Since I think this would be a common scenario I wanted to blog about it so that others can see what approach I was using. My example below is not the same one that I used for my project but instead a simple sample scenario that should get you moving in the right direction.
- Create a Document Library
- Configure permissions so that the users will not have the ability to delete items. Usually for this I create a custom permission level called Contribute - No Delete and then assign that permission to the members group. Once this is completed, those users will not see the option to delete within that library.
- Next we will want to create the workflow that we want to start when the item is deleted. For my example the workflow is going to email the creator of the document and let them know that it has been deleted and provide them a link to email the person who deleted the item. I am just doing this as an example, in theory you could create any workflow here.**Note: to delete the document we need to use the Impersonation Step because the person kicking off this workflow will not have access to delete the items but the author of the workflow does. If this concept is new to you, then you can look here for some additional information about workflows.
- Once we have the workflow created, we will want to use SharePoint Designer to create the quick action for the library. Below are the screenshots for my configuration.**Note: You can use the Rights Mask option to only make the action visible to users with certain permissions. Click here for a list of the different values you can use to configure this. This may not apply to a delete workflow but I imagine there are plenty of times that you want different workflows for different users. This approach may help you only show was is relevant for that particular user. An example I used recently was a workflow for standard users and then a different version of the same workflow (more configuration options) for users who could manage the lists.
- As a final step in customizing the workflow I am going to customize the form so that the initiation screen appears to the user like a confirmation screen.
- Now we can test the final solution.
- Quick Action in the List Menu
- Workflow Initiation Form
- Item is Deleted from Library
- Email is sent to creator
**Note: After posting this blog, Brian Jackett sent me a link to a similar blog on his site by guest author Lucas Eduardo Silva around this topic. His solution uses custom code to accomplish the same type of task. What I love about community is that everyone shares the different ways that they accomplish the same thing. Since we are all sharing what we are doing we have a large pool of experience to pick from. Here is the link to the article if you would like more information on his approach.
No comments:
Post a Comment