How to hide or disable the Delete Item in the task list RRS feed

  • Question




    I have a workflow that add an item in the task but I have the following concers


    1. How Can I disable o hide the delete iyem option in the task list? The user can delete the task assigned to them and the workflow will be lost because the user remove the other way to interact with it.

    2. How I can sincronyze the document which started the workflow and the task added? example. The user add a new doc and a workflow is started. The workflow add an item in the task. Two days after the user delete the doc. what I think should happen is to closed the workflow and delete the task in the Task list.


    Does Somebody has ideas about?


    Also, Could someone tell what is the better way to start a workflow? O know there are many ways but I try to find the better ways for the user.




    Wednesday, October 10, 2007 8:08 PM


All replies

  • You can disable the delete option by creating a permission level which deny's delete permission.  Are you familiar with permission levels?


    I think the approach for number two would be to create an ItemDeleting event handler which locates the task and associated workflow.  I have not done this and haven't heard of anyone doing it, but it should be possible.  Have you worked with event handlers before?

    Thursday, October 11, 2007 1:39 AM


    I am not familiar with Permission level but I will research about it and see how I can implement this idea. I have worked with Handlers but I am not sure if I understood you idea. I will try.


    Thank you very much!



    Thursday, October 11, 2007 12:59 PM
  • Hi,


    I have the same problem and I'm not familiar with permission levels. Can you explain me what I have to do.


    I want to create new items, edit them but the items must not be able to be deleted.





    Monday, October 22, 2007 12:59 PM
  • The article here (http://blah.winsmarts.com/2007-4-SharePoint_2007__Fine_grained_permission_control.aspx) looks like a good starting point.


    If you're still stuck, post back and we'll help!


    Tuesday, October 23, 2007 1:46 AM
  • For item #2, if you can figure out how to create an event receiver (ItemDeleted) for the list containing the document that got deleted in the middle of the workflow, you'll need to figure out how to reach inside the workflow, find all the tasks, and one-by-one, call AlterTask.  AlterTask will in turn, automatically call your OnTaskChanged event.  In the Hashtable argument you pass to AlterTask, you could be clever and add a user-defined key/value of "DocIsGone"/"true".  That HashTable winds up bing the AfterProperties inside the OnTaskChanged event. Inside OnTaskChanged event of your workflow, you'll need to check for this special key/value pair in the AfterProperties of the task.  If it's present, you'll know your OnTaskChange event was fired by the special "the document is no longer around" logic in your ItemDeleted event receiver vs. a real person completing their assigned task.  I do this type of "auto-complete a task that is overdue" all the time, but the difference is, all my code is INSIDE the workflow (using DelayActivty as part of a ConditionedActivityGroup).  The important difference between what I'm doing and what you need to do is you need a combination of INSIDE the workflow code and OUTSIDE the workflow code (ItemDeleted event receiver).  I only know the INSIDE part.


    What I don't know how to do is tell you how to reach into a running workflow from an ItemDeleted event receiver on the list where the now-deleted Document that was the subject of the workflow used to live; otherwise, I would provide sample code.


    Does my "half-answer" stimulate others to perhaps help this guy flesh out the rest of the solution?


    Saturday, March 8, 2008 6:22 AM

    Sorry guy that I did not reply before. All your Ideas were great and I use all them for fix my problem


    Thank all!!


    Tuesday, June 3, 2008 2:44 PM
  • he guys ,  i get it :)


    you just create new Permission Level , in List Permisstion, you uncheck Delete Item

    so now you can see have no Delete Icon on View Item



    Thursday, December 15, 2011 6:42 AM
  • I know this is a really old thread, but just in case someone else is looking for an answer, I thought I would add another option to the other 2 that have been discussed

    The other way (though it will affect all tasks that are shown using the IniWrkflIP.aspx file) is to comment out the <SharePoint:FormComponent TemplateName="WorkflowEditFormToolBar" ControlMode="Edit" runat="server"/> HTML in the C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\IniWrkflIP.aspx  file. THis may actually be a good thing, since deleting the task from here is moist likely an audit trail issue anyway.

    Just my 2 cents worth



    Friday, August 22, 2014 5:02 AM