Copy Item with connected sub list items
I am hoping you can help me.
I have a list with a sub list linked to it. Users have requested the ability to create an item based upon the current item they are working on, copying all of the content from the item in the main list and also the sub list to a new item in the same list which then opens.
For copying the main item I am simply using the Add List item command and using all of the existing fields – easy!
I can also use the open list item command and open the last item created by the user – simple!
However I am not sure how to copy across the sub list items which relate to the item being copied. Is this a case of using the execute script option? If it is, please could you let me know what this might look like (I’m not an expert in this by any means).
Thank you in advance for any help that can be given.
-
Hi Setup and Demonstration Account
You're on the right track. To copy a CaseFile you can use the "Add List Item" action to create the main item, but for iterating through subitems and duplicate them with reference to new main item, you have to create a "Execute Script" action.
To get the subitems and iterate through have a look at this post, where we answer how to get sublibrary documents and send its links in a email Using QueryList in Skybow Forms. In your case you should create the new subitems inside the iteration instead of concatenate a string.
One thing is good to know: Sublist items are related to the main item by a lookup. Sublibrary documents just by a named folder "{mainlistname}-{mainitemid}". This must considered in building the CAML parameter of the QueryList function.
Hope this helps to start building your "Copy CaseFile Action". Feel free to ask if you need more information.
0 -
Thank you. I needed to action something very quickly for the client so used an alternative method. However this looks to be very helpful and I will keep this in mind for future issues.
Thanks again!
0 -
There is a new idea for this specific functionality Copy/Duplicate list item action open for voting
0
Please sign in to leave a comment.
Comments
3 comments