locked
Referencing Parent-Child List Items in SharePoint 2010 Workflows RRS feed

  • Question

  • I have a typical parent-child one-to-many relationship between lists.  Each child list item contains a dollar amount.  How can I sum up the dollar amounts in all related child list items and write this sum into a column in the parent list item?  I am stuck on how to relate parent and child items using Workflow syntax -- especially since my experience thus far has all been single list-related workflows.  I.e. is there a way to identify child items in a parent list workflow with some sort of WHERE clause (WHERE childlist.id = currentitem.id)?  There are many posts here that make me believe this is possible; I just need the specifics.  Thanks.
    Thursday, September 17, 2015 1:11 AM

All replies

  • I don't think the out-of-the-box SPD workflow actions can accomplish this. The functions available are extremely limited and there is absolutely no looping logic in no-code workflows. So, if I understand this you have a Client List (the parent) and an Orders list (the child), with a value column and a lookup column to the parent. But you want to show the sum of the value column for each client in the parent table. I think it is safe to say this can't be done in a no-code solution. So, your options are to modify your requirements or code a solution via custom workflow action(s). Below I showed the easiest solution out of the box, which is to sum the Parent items in a view in the child list. However, this doesn't put the total in a column, which is what you want. If you want the total in a column, you will need to use a custom dataview created in SPD. In my opinion this is as complicated as coding a solution as XSLT is not for the faint of heart. But here is a blog that shows how to do put the sum in a new row in an XSLT. It should be relatively easy to put it in a custom column instead, though.

    http://sympmarc.com/2011/07/19/summing-a-column-in-a-data-view-web-part-dvwp/


    Lance

    Tuesday, September 22, 2015 5:51 PM