CrossDoc: How to increment a value based on synced table

I have a table of Purchase Orders (POs) that are cross doc’d (CD) from original doc (OD) into my working doc (WD). Each PO in OD has a number: 1,2,3…

I generate new POs in WD. Currently I am using CrossDoc::AddRow to create a new PO in OD from WD. I find the next PO number by using OD.[PO].max()+1 to increment.

The issue comes up if I want to create more than 1 new PO per hour. Right now the only way I can see to do this is to have the user use the CD function, then manually sync the table, then check to see if the new record has gone through, then generate the next one. This is a very tedious process that doesn’t scale, especially since you can use the AddRow function and then sync and it doesn’t always “take” … you have to wait and sync again.

Anyone have an idea on how to improve this? Thanks! :pray: