views:

197

answers:

1

Hello.

I`v come across a need where I want to create multiple list items from within a workflow and be able to view workflow history from any of that item.

The problem context: In a recurring meeting, Agenda items are added. Some items have "open" status and some "closed". Those who have open, have the ability (and probably will) continue to be on agenda list further ocurring meetings. If user chooses to continue the item, from within a workflow I create a new item.

The result is, we have an item sequence like

  • Day 1: "Discuss problem A" (Parent item field value: null)
  • Day 2: "Discuss problem A.1" (Parent item field value: ID of Discuss problem A)
  • Day 3: "Discuss problem A.2" (Parent item field value: ID of Discuss problem A.1)

The thing is I want to be able to track this stuff in workflow history and be able to view it from any item. So in a workflow they should be in same state as all other items.

Any ideas on how to assign the same workflow for all those items?

A: 

To the best of my knowledge, you will not be able to run ONE workflow for multiple items. Each workflow always executes in the context of one item.

One idea I had would be to use another list (referred to below as AgendaHistory) to manage the history for all agenda items. Every time an agenda item is created, if it has no parent create a new ID. If the new agenda item has a parent, use the parent's ID. The ID would be used to lookup history for all agenda items.

Then, for all agenda items you just need to link to a page that would show the history for a given thread. This page could have a List View webpart that filters on Agenda ID using a Query String Filter webpart.

For example:

  1. User creates Agenda Item "Problem A"
  2. Workflow determines Agenda Item "Problem A" has no parent and logs to AgendaHistory list: AgendaID: 1, Title: The agenda item "Problem A" has been created!
  3. Workflow Updates Agenda Item "Problem A" with a link to Pages/MyHistoryPage.aspx?AgendaID=1
  4. User creates Agenda Item "Problem A.1"
  5. Workflow determines Agenda Item "Problem A.1" has a parent and logs to AgendaHistory list: AgendaID: 1, Title: The agenda item "Problem A.1" has been created!
  6. Workflow updates Agenda Item "Problem A.1" with a link to Pages/MyHistoryPage.aspx?AgendaID=1
  7. User creates Agenda Item "Unrelated Problem"
  8. Workflow determines Agenda Item "Unrelated Problem" has no parent and logs to AgendaHistory list: AgendaID: 2, Title: The agenda item "Unrelated Problem" has been created!
  9. Workflow updates Agenda Item "Unrelated Problem" with a link to Pages/MyHistoryPage.aspx?AgendaID=2
  10. ....
Kit Menke
This solution works very well. Thank you for the idea.
Janis Veinbergs