table with portal duplication
I have a table which is used to manage offers, orders, transport documentation, invoices. Documents which are sharing most of data.
The table has a related portal with line items.
The logical path would be to be asked for offer, followed by order, ...... therefore from an existing record, e.g offer OF025/2013, I would like to generate the order OR012/2013.
name and numbering of the single category is done automatically based on the category name and selecting highest+1.
when user is creating a new document from an existing one he's been asked to select which category is the new one. All fields and related table are correctly copied.
Issue is with the name and numbering. I'm not able to assign the correct category in the new record and obviously numbering is failing too.
In attachment you'll see script for duplicating the document.
Thanks in advance for your help