AnsweredAssumed Answered


Question asked by Vinny on Apr 25, 2012
Latest reply on Apr 30, 2012 by erolst


Duplicating & Deleting Multiple Portal Rows



I have something similar to the setup in the screenshot below.  I have an invoices table, and a quotes table.  Both tables use a related table called Items (i.e. your invoice our quote includes items).

In script, I would like to copy all items related to the quotes table, and duplicate them, then assign or "link" them to the invoices table.  The linking could be handled by simply changing the fields so that the relationships match.

I would also like to be able to replace all existing quote items with a copy of those items linked to an invoice.

I was headed down the path of stepping through the related records in a loop script, and I was hesitant to go down that path without consulting the forum.

I would like to avoid having to jump to different layouts if at all possible.

The layouts for both invoices and quotes would contain a portal for the items table.

Also, the function of the script would be all or nothing; that is: invoice would either not contain any items or all items would be deleted before copying all items from the quotes table (and vice versa).  There would be no partial copying of related records either.

By the way, I am using a calc field called CALC_Table Name (just calculates it's own table name) so that my items table can be shared across both invoices and qutoes tables.

Please let me know if anyone has ideas.

Thanks in advance.