locked
Move a list item to another list - permissions? RRS feed

  • Question

  • I have two lists that are identical (created from the same template).  The first is a general complaint list, the second is a management complaint list.  I want to move a list item from the general list to the management list if the field Issue Type starts with "Staff".  The idea is if the complaint is directed at a staff, the complaint should be moved to the management list for resolution.  I created a workflow that does exactly this, by copying the list item from one to the other, then deleting the general list item.  This works fine except when I change the permissions for the management list to only include management staff.  Then I get a "list doesn't exist" error in the workflow for people with only permission to the general list.

    So my question is, how can I run the workflow with elevated permissions?  Or can I set the permissions of the management list to add for "anybody", but read and modify for management staff only?

    So I want all staff to be able to create a list item in the management list, but I don't want them to be able to see it, or modify it in anyway, in any view.

    Thanks

    Clarence
    Friday, November 27, 2009 6:46 PM

Answers

  • I don't think there's anyway you can do this without writing custom code.  Unfortunately, you cannot create a custom Permissions Level that grants just add without also granting the view permission. 

    You have a couple ways you can do this in code:

    1. If you really want staff users to be able to create items (and also see the management list), I would just write an event receiver on the management list.  In the ItemAdded event, break inherited permissions for the item and adjust to match your business rule.  When your current workflow kicks off and copies over the item, the event receiver should handle the permission change for you.  You'll probably need to wrap the event receiver in a RunWithElevatedPrivileges block.

    2.  If you don't want staff users to even see this management list.  You would instead add an event receiver on the general complaint list for the ItemAdded event.  Again, use RunWithElevatedPrivileges to move the item to the management list.  In this case, you wouldn't need to adjust item permissions on it as the list already has the appropriate permission.  In this case, you wouldn't need the workflow, and the logic for checking the field issue would be done in the event receiver.

    Hope this helps give you some options.


    Randy - http://sharepointhawaii.com/randywilliams
    Saturday, November 28, 2009 2:34 AM