I'm going to assume that the table occurrence for you "past items" portal, is named PastLineItems adn your new portal is named LineItems. Just subsitute the actual names for mine in the following script:
#This script should be performed by clicking a button in the PastLineItems portal.
Set variable [$Item ; Value: PastLineItems::ItemID]
Set variable [$Qty ; Value: PastLineItems::Qty]
Set variable [$QuoteID ; Quotes::QuoteID ] //am assuming current layout is based on Quotes table occurrence
Go To layout [//select layout based on line items]
Set Field [LineItems::QuoteID ; $QuoteID ]
Set Field [LineItems::ItemID ; $Item ]
Set Field [LineItems::Qty ; $Qty]
Go To layout [original layout]
Description and Price should come from a Products table that is related to LineItems so I don't think you'll need to copy them over as copying over the Item ID should be sufficient to link the Line Item record to a Products Record.
Note: You can either place a button inside the portal row or you can select all the fields in the portal row and use button setup... to turn them into a button. Either way, the mouse click on the button, both puts the focus on the selected portal row and performs the above script.
Phil, actually the services we are quoting are pretty much custom every time so there is not a product table, just the line item table, with those 3 fields (plus the key field and a couple of calculation fields used for other purposes). There are two table occurences for the line item table, Lineitems and Lineitems 2.
So what I am getting is that I need to go to a Lineitems layout, create a duplicate record except using the new quoteID, then back to the original layout. Correct?
Yes, and you can then bring along the additional data in additional variables here. You could do this with by interacting directly with your portal, but I prefer to go straight to the portals table as it is less likely to be affected by future changes to your layout.
Your wording just sparked an idea for another approach if your two portals are to the same data source table:
Set Variable [$QuoteID ; Quotes::QuoteID]
If [ Not IsEmpty ( PastLineItems::ItemID /* There is a record in the portal to select */]
Go To Related Record [Show only related records; From table: PastLineItems; Using layout: "lineItems" (lineItems)]
Set Field [LineItems::QuoteID ; $QuoteID]
Go to Layout [Original Layout]
I like that idea, should run pretty fast and be nearly invisible to the user.