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.

clip_image002

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

clip_image004

 

UPDATE LIST ITEMS v1.0 USERS GUIDE

clip_image006

In SharePoint Designer, select the "Update All List Items" action from the menu

clip_image008

Or just do the inline typing

clip_image010

There is only 1 dialog for this action - I cheated and reuse the dialog from Update Item Workflow Action

clip_image012

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.

clip_image014

OK and trigger the workflow

clip_image016

 

SUMMARY NOTES

  1. 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.
  2. 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.
  3. Obviously, if your list is extremely large you are on your own :-)
  4. 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).