appendToDocumentList with outer/inner documentlists

Hi,

I’m attempting to map a document to another document, both docs have parent and child document lists. (Orders and Line Items)

Basically,
I loop over the orders
Map the order information to a temp record (clone of the receiving doc)
appendToDocumentList (the temp to the receiving doc) -Drop temp
–start inner loop for item detail
–map item detail to cloned temp doc
–appendToDocumentList (temp to receiving doc) - Drop Temp

I am also dropping the toList/fromList/fromItem variables.

Unfortunately, the items seem to just reference each other…repeating the same item detail even for each order. Orders information works fine.

thanks in advance!