none
Workflow with Parent/Child Items

    Question

  • Hi all,
    This is my first post, so please be gentle! I am having real troubles getting Workflows to work for my need in SharePoint 2007. I am trying to create a basic task tracker using lists, whereby each project in the first list spawns the same repeated tasks in the seconds list (each one can be assigned to different people, and tracked independantly). Here's the setup:

    Two lists: ParentTasks and ChildTasks (for example)

    Upon adding an entry to ParentTasks, Workflow-A will automatically create 5 entries in ChildTasks (each linking back to the ParentTask with it's ID, and each in a Status of "Waiting for someone else" except ChildTask1 which should be "Not Started") - This works fine.

    Upon changing the Status of any entry in ChildTasks to "Completed", Workflow-B should change the status of various (defined) other tasks in ChildTasks to "Not Started". i.e. Activate them so they can be worked on.

    E.g.

    ParentTask1 in ParentTasks
    ParentTask2 in ParentTasks

    ChildTask1 in ChildTasks linking to ParentTask1
    ChildTask2 in ChildTasks linking to ParentTask1
    ChildTask3 in ChildTasks linking to ParentTask1
    ChildTask4 in ChildTasks linking to ParentTask1
    ChildTask5 in ChildTasks linking to ParentTask1
    ChildTask1 in ChildTasks linking to ParentTask2
    ChildTask2 in ChildTasks linking to ParentTask2
    ChildTask3 in ChildTasks linking to ParentTask2
    ChildTask4 in ChildTasks linking to ParentTask2
    ChildTask5 in ChildTasks linking to ParentTask2

    Upon changing Status of ChildTask1 from "Not Started" to "Completed" - the Status of ChildTask2 should be changed to "Not Started"
    Upon changing Status of ChildTask2 from "Not Started" to "Completed" - the Status of ChildTask3 and ChildTask4 should be changed to "Not Started"
    Upon changing Status of ChildTask3 from "Not Started" to "Completed" - do nothing.
    Upon changing Status of ChildTask4 from "Not Started" to "Completed" - the Status of ChildTask5 should be changed to "Not Started"
    Upon changing Status of ChildTask5 from "Not Started" to "Completed" - the Status of ParentTask1 should be changed to "Completed"

    How do I achieve this using SharePoint 2007? I have tried everything I can think of, but don't seem to programatically select the item in the ChildTasks list, as it appears you can only define a single criteria match - but I need two (the title of the item and the ID of the ParentTask).

    I have tried writing the ID of each ChildTask item into a column of the ParentTask upon creation, with the hope of reading it into Workflow-B, but that doesn't work (the variables must be List ID types).

    Apologies if this seems basic, or if there is a simple solution - but for the life of me I can't figure this out!

    Any help gratefully received.

    James


    • Edited by jjrbg Wednesday, September 05, 2012 2:57 PM
    Wednesday, September 05, 2012 2:56 PM

Answers

  • James

    firstly welcome.

    Workflows are interesting in as much as they drive their logic from the item that triggered them and that you really need to have enough information contained in the item to figure out what you need to do.

    what I would do is when you are creating you child tasks as well as having the ID to link them back to the parent I would put in some sort of sequence number that links to the next task. This will make it easier to identify and hence change the next task in the sequence.

    For example if you have childtask1 with a field called sequence =1 you can search for the next task by simply adding 1 to the sequence number in the workflow so you are looking to change child task with the parent ID and a sequence of sequence+1

    If you do this right then you could simply ave a single piece of logic though you could initially do it in multiple steps.

    Hope this helps and gets you back on track

    Kenny

    • Marked as answer by jjrbg Friday, September 28, 2012 11:07 AM
    Thursday, September 06, 2012 8:17 AM

All replies

  • James

    firstly welcome.

    Workflows are interesting in as much as they drive their logic from the item that triggered them and that you really need to have enough information contained in the item to figure out what you need to do.

    what I would do is when you are creating you child tasks as well as having the ID to link them back to the parent I would put in some sort of sequence number that links to the next task. This will make it easier to identify and hence change the next task in the sequence.

    For example if you have childtask1 with a field called sequence =1 you can search for the next task by simply adding 1 to the sequence number in the workflow so you are looking to change child task with the parent ID and a sequence of sequence+1

    If you do this right then you could simply ave a single piece of logic though you could initially do it in multiple steps.

    Hope this helps and gets you back on track

    Kenny

    • Marked as answer by jjrbg Friday, September 28, 2012 11:07 AM
    Thursday, September 06, 2012 8:17 AM
  • Hi Kenny,

    Thanks for your reply, I really appreciate it. Your solution makes sense in theory, but I can't seem to make it work in practice!

    My workflow:

    Conditions: If Title equals ChildTask1 and Status equals Completed

    Actions: Calculate Current Item ID plus 1 Output to WorkflowVariable1 (List Item ID type) then Update Status of item in ChildTasks to Not Started where Field ChildItems:ID is Value WorkflowVariable1

    The workflow fails with an error (it doesn't specify why).

    My guess is it can't calculate adding an integer datatype to a List Item ID datatype?

    Apologies if I've misunderstood your suggestion.

    Thursday, September 06, 2012 3:22 PM
  • James, Don't use the item ID, create a new field then you can control the data type and it will make it easier.

    Kenny

    Wednesday, September 12, 2012 7:28 AM
  • Kenny,

    Hero! Thank you very much. I understand what you were suggesting now. Create a "MyID" column in the ChildTasks list, populate it upon the creation of the ChildTasks in the Workflow-A based on the ID of the ParentTask. To keep it unique, I opted for:

    MyID of Child Task(n) = (ParentID * 1000) + n

    This gives me a nice way of selecting the particular task in the Workflow-B.

    Convoluted solution, but that's the nature of how these workflows seem to allow you to interact with the lists. Thanks a million for your help.

    James

    Friday, September 28, 2012 11:07 AM