Populate sub-list item columns with list item column values - When form is saved I need to duplicate some of the list information on to the sub-list information
Original Post by Sandy (Imported from Ardevia Forum)
Hi,
I have an Invoice List and a Lines list that are related via a column on the Lines list (IID) that has a lookup to the ID column on the Invoice List.
I want to take the Lines list and import that into our Finance System and have included some extra columns on this list that I want to populate with the value that exists on the Invoice List.
Invoice List
ID
Invoice_x0020_Date
ETL_x0020_Status
Line List
ID
IID - (lookup to Invoice List ID)
Inv_x0020_Date
ETL_x0020_Stat
Invoice_x0020_Date should also populate each Line list (Inv_x0020_Date) related to the Invoice.
ETL_x0020_Status should also populate each Line list (ETL_x0020_Stat) related to the Invoice.
I have tried adding an action to my Save button to update the list item, but it can't find the ID on the sub-list. This action is placed after the Save Form action.
Any help you could offer would be appreciated.
Thanks
Sandy
-
Original Post by Vladislav (Imported from Ardevia Forum)
Hi,
Can you explain with more details what does it mean: "it can't find the ID on the sub-list"? What exactly you want to do and for what result you expect?
0 -
Original Post by Vladislav (Imported from Ardevia Forum)
Hay, Sandy.
Thank you for details.
I think the problem is in Update Action in List Item ID Expression. You need to retrieve list items IDs in Sublist with some caml query using Assigment Expression (not just [[ID]] placeholder).
Here is what I tested and it's working for me (I used same field and list names, but you can correct it; title of Sublist is first argument in GetValuesForQuery method):
[[@Web.GetValuesForQuery('invoice-linelist', '<Where><Eq><FieldRef Name="IID" LookupId="True" /><Value Type="Text">[[ID]]</Value></Eq></Where>', 'ID')]]
Also, I think, you will need write some Condition for this Action. Because if it's no items in Sublist you shouldn't run Update action. You can also use such Caml query for Condition in your Update Action:
[[@Web.GetValuesForQuery('invoice-linelist', '<Where><Eq><FieldRef Name="IID" LookupId="True" /><Value Type="Text">[[ID]]</Value></Eq></Where>', 'ID')]]
0 -
Original Post by Sandy (Imported from Ardevia Forum)
Awesome, that worked perfectly.
Thank you so much, you're a star.
0
Please sign in to leave a comment.
Comments
3 comments