I know its easy to batch cancel workflows, but I was not able to find a straight forward way to batch start workflows at a list/document library level. The solution I have posted allows you to specify the criteria on which files you want to start a workflow on. You could run it on ANY file in the library, even if it doesn't meet the criteria you are looking for and it'll loop through the collection and start as needed on the right files.
The Scenario:
-Doc Library with minor and major version docs
-Want to start workflow only on documents that has a status of final as defined in a list column
The setup:
-Create a view that shows all files as flat without folders
-Display the ID column
-Sort By ID, first by ascending to get the ID of first item in list; note it for later. Then sort by descending, taking note of the highest ID listed
The Workflow:
-Set both the count and IDcount variables to the lowest ID identified above
-Set the loop condition to run until it is less then or equal to the value of the highest ID identified above
-Define your scenario to selectively start wf on list item that qualifies
- I told it to look at the ID of each entry and then see what the "Lifecycle" column says for that particular item with that ID
-Source: your list or document library
-Field: The field you are comparing against
-When :ID
-Equals: Variable IDCount
-Then I define what the Lifecycle Field is supposed to contain in order to satisfy the condition of the run-if; in my case I want it to only runwhen it says "Final"
-Make sure the none of the files that will meet the run if criteria are not checked out otherwise the wf will fail out at the first instance ofa checked-out file it tries to run a wf on. You could always throw in a force checkout action into the loop to avoid problems.
-Then in the web service call, define an account that can run the action, define the workflow you want to batch run, and define and parametersyou want to pass off
-Publish WF and start on any item in that library
Depending on how much processing power you have and the amount of docs that need to be processed, run this over night or over a weekend to avoid disrupting system performance for other users.
Let me know what you think or if you have any suggestions or questions.
Thanks!