I guess that the lines for an invoice are records in a related table, is that right ? If for example you have:
Invoices <---------> Lines related by Invoices::Number
You need to duplicate the record of the specific invoice as well as all the related records in Lines. Does that makes sense ?
planteg gave you the big answer of having to duplicate the invoice record as well as all of the related items table probably by a looping script. But another question is identifying what you don't want duplicated such as invoice date or invoice number.
Thank you Planteg!
So for example we create an invcoice that has all of the labor and materials plus the cost, i want to create a button with a script to duplicate that entire invoice. Right now it just duplicates the record info like name, address, etc..I want it to duplicate all the materials and labor that I have added as well.
I guess i can modify that button to duplicate everything but I don't know how to script it.
does this look right??
Create duplicate invoice
Store primary key in a variable
Go back to original invoice
Go to related records from Invoice to related details.
Loop through records
Duplicate and use variable to set foreign key in new record.
Do this for each group of related records.
1 of 1 people found this helpful
You may wish to search for 'duplicate related' on this forum.