SharePoint 2010 - Update All List Items SharePoint Designer Workflow Action
/Out of the box - SharePoint provides quite a few different Workflow Actions, but strangely missing was a Workflow action that can loop through and update all items within a list.
Figure: Update List Item (but only works with one item)
Further to my shock was that someone out there (cough Codeplex) hasn't written one yet. So last night I sat down and start to code. There will be another article about coding and packaging a SharePoint Workflow Activity, but right now, I need to shove my baby out the door.
UPDATE LIST ITEMS v1.0 INSTALLATION
Everything in one WSP file: grab it here
The package includes 3 objects:
- WorkflowActivity.dll - goes in the GAC
- WorkflowActivity.ACTIONS - goes into <SharePointRoot>\TEMPLATE\1033\Workflow\WorkflowActivity.ACTIONS
- <authorizedType> entry needed in Web.Config - I've included a Web Application feature that will do this
To activate the web application feature
UPDATE LIST ITEMS v1.0 USERS GUIDE
In SharePoint Designer, select the "Update All List Items" action from the menu
Or just do the inline typing
There is only 1 dialog for this action - I cheated and reuse the dialog from Update Item Workflow Action
Unfortunately, because I cheated and use Microsoft's dialog - it won't let us finish without specifying a List Item - hence I use the sentence "Update all items in this list (ignore list item)" - sorry - hope that was clear.
OK and trigger the workflow
SUMMARY NOTES
- In SharePoint, a workflow can not trigger itself. So even though I have the workflow set against this list - it is only run on the last item.
- And because this is version 1 (v1.0) there's some really complex looking code for setting "People or Group" values. So I'm not sure if this works 100% in my implementation.
- Obviously, if your list is extremely large you are on your own :-)
- One other scenario this opens up is the facility to have a site workflow "trigger" a second workflow set on a particular list (remember - workflow can't trigger itself).