Duplicating Bill Of Materials (duplicating portal line items)
I currently have three layouts I'm concerned with - my Bill Of Materials layout, Line Items, and Parts Inventory. I managed to create a nice BOM (Bill Of Materials) layout where the user can add parts from parts inventory to the BOM's line items (a portal connecting to the Line Items table). It does this by the user searching for a desired part. Then, when they select that part - a script takes that part's unique ID (kp_partID) and assigns that to a new Line Item's related field (kf_partID). It then takes the BOM that the user was creating, and inserts its unique ID (kp_BOMID) into that line item's related field (kf_BOMID). The script then returns the user to the BOM Layout and they see their desired part, as a line item featured on that BOM.
The problem here, is that a lot of BOMs have a similar build, say out of 25 line items, 22 can be the same. I was wondering how I could duplicate a BOM fairly easily in a way that it will not only duplicate the BOM itself, but also duplicate the line items, and have them sitting in the portal of the duplicate BOM. This can't be done with just the duplicate record command, because the portal line items don't get copied over (which I totally understand). But I am having a mental roadblock on how to do this. Can anybody help? Thanks.