I have a similar situation, but with multicontainor production batches (duplicating material requests and the associated line items) and again with final material receipts when the "oh, we need this too" happens.
Since the needs are different for my two, I do this two ways. Which makes more sense to your application in your business?
Trap the existing key in a variable
Duplicate the quote (giving it a new PKey via autoenter serial)
trap the new Key in a variable
Go to the line items table
find those line items with the old key
loop through the found line items, duplicating each one and giving the duplicate the new key
Save each version as a pdf and load it into a containor field
Note: I on't put it into a containor...in a folder named well works for me...but it could be put in a containor.
Again, which makes more sense in your situation?
Your help was tremendous! Using your #1 version gave me the genisis of what I finnally did. In the Last 36 hours I've had 3 hours of sleep. This is so addicting. I had never done complex scripting before. I now have good experience with Looping , Script Variables and the thought Process involved. It came out tremendous. My employees have never seen me so happy! I was jumping around when it finnally worked!!! I have been struggling in the back of my head for many months on how to make this happen. I must admit there is some joy when it finally does work. Beleive me I had bugs. I kept forgetting to commit the record in my scripting, umunge other many issues.
Anyways, KUDO's to you and all filemaker nuts!!
I can't beleive I struggled for so long and here I get on this chat room and my problem was solved in 6 hours.
Very glad to hear of your excitement:)...now get some sleep, your next project needs you to.
Enjoy the day!