How do I duplicate an invoice and line items within it?

I think you have to use a third-party option like Make to get this to work.

You would have to create a JSON structure in the Invoices table to represent the invoice columns, and an array of items that are related to that invoice.

Send that structure to Make using a webhook action, and then use a parse JSON module.

From the resulting JSON, first, use the Glide API to create an Invoice line with the invoice-level info. You will then get the rowID of the invoice.

Create an iterator to iterate through the list of “original line items” from the parse JSON module, and add them to Glide using the Glide API, and make sure you add the rowID of the invoice to create a relation between them.