Duplicate a record and her related records

Discussion created by BKamp on May 10, 2016
Latest reply on Jun 7, 2016 by BKamp

Hi guys!


I need to add some features to my bookkeeping system. I started out with the standard bookkeeping system by filemaker to keep track of clients and invoices.


In my invoice table I have a field (invoice/quote) to select if it's either an invoice or a quote/bid. Whenever I sent a `quote`, and the client accepts it, I would like to copy the quote` record and it's related records (invoicedata) and set the field to `invoice` instead of `quote`

here's my table setup:



I created this script so far on the invoice layout:

-set var $clientID

-set var $invoiceID

-duplicate record (the invoice)

-set `invoice/quote` field to `invoice` instead of `quote

-set client ID field with $clientID


now, how can I duplicate the related invoice-data records and set their `invoiceID related field` to the newly created invoice's ID?