Skip to main content

Ten thousand orders over a weekend

At go-live, Contoso moves ten thousand invoiced but unpaid orders and its stock from the legacy system over one weekend: the set-based entities turn the files into journals, the refused rows are fixed and resent without duplicates, the journals post in the background, and the figures are reconciled by Monday morning.

The situation​

Contoso Entertainment System USA (legal entity USMF) goes live on Finance and Operations on Monday 2 November. The legacy system holds ten thousand customer orders that were delivered and invoiced but not yet paid, and the stock in warehouses 11 and 13 of site 1. In the legacy system they are orders; in Finance and Operations they become what they are for accounting: open customer invoices, ready to be paid and settled, and stock on hand. Orders still waiting to ship go through Microsoft's standard sales order entities in a separate load: Lattice has no set-based entity for sales orders, and this story leaves them out.

Three people carry the weekend:

  • Jordan, data migration lead, holds the Integration operator role and a standard data management role, and runs the loads.
  • Malia, controller, owns the opening balances and signs off the migration.
  • Marcus, ERP administrator, holds the System administrator and Integration administrator roles.

The legacy system is frozen on Friday at 18:00. Collections start calling customers on Monday at 09:00, so every open invoice must be in Finance and Operations, posted and correct, by then.

Why it matters​

  • Ten thousand invoices are far too many to post one service call at a time in a weekend, and a load that fails half way must not leave anyone guessing which invoices arrived.
  • A few bad rows are certain. They must not hold up the other rows, and fixing them must not duplicate anything.
  • An invoice loaded twice is a customer asked to pay twice; an invoice missing is money never collected.
  • Malia needs evidence, not a feeling, before collections start.

What Jordan does​

The weeks before: rehearsals​

  1. Jordan exports a data entity template for each entity, typing its name on System administration > Periodic tasks > Lattice data entities > Data entity template: MGCLatticeSetBasedCustomerInvoiceJournalLineEntity and MGCLatticeSetBasedInventoryJournalLineEntity, as Excel workbook (.xlsx). The legacy team fills the workbooks' columns from their extract. See I want to give the source system team a template to fill in.

  2. Malia prepares the target: October open in the ledger, the journal names GenJrn and IMov with their number sequences, and a migration clearing main account that allows manual entry, since a control account is refused as the offset. Posting calculates sales tax on each invoice, so Malia and the tax accountant decide which sales tax groups the opening invoices carry, and the rehearsals prove that no tax is charged a second time. See Migrate data in bulk.

  3. Marcus checks on Data management > Data entities that Set-based processing is selected for Customer invoice journal lines (set-based) and Inventory journal lines (set-based), activates DMF execution completed and Integration item parked for USMF on the migration team's endpoint, and registers a client for Jordan's posting script with its own user holding Integration operator. See I want to be told when a data management import or export finishes.

  4. Each invoice is one row: the legacy invoice number in InvoiceNumber, the original invoice date in DocumentDate, the legacy due date in DueDate, the legacy order number in Description so collections can find it, and the clearing account in OffsetAccountDisplayValue (left out of the sample below). Grouping keys AR-OPEN-01 to AR-OPEN-10 split the invoices into ten journals of about a thousand lines:

    JournalNumber,JournalNameId,LineNumber,TransactionDate,CustomerAccount,InvoiceNumber,DocumentDate,DueDate,Description,CurrencyCode,DebitAmount
    AR-OPEN-01,GenJrn,1,2026-10-31,US-001,LEG-208811,2026-10-05,2026-11-04,Legacy order 55102,USD,1250.00
    AR-OPEN-01,GenJrn,2,2026-10-31,US-001,LEG-208954,2026-10-12,2026-11-11,Legacy order 55187,USD,980.00
  5. Stock is one row per item and warehouse, with grouping keys INV-OPEN-11 and INV-OPEN-13, a positive InventoryQuantity (a receipt) and the clearing account in OffsetMainAccountId. UnitCost is left empty, so each line takes the item's inventory price, which the costing team set before go-live. See Inventory journal lines (set-based).

Saturday: load, fix, resend​

  1. Jordan creates an import project in Workspaces > Data management with Customer invoice journal lines (set-based), uploads the file and chooses Import in batch. The DMF execution completed event reaches the team's channel with its outcome and the record and error counts, which include the refused rows. See I want to import a large journal file as ready-to-post journals.

  2. View staging data shows every row Completed or Error, and two messages on the refused rows:

    • "The import has more than one line with this customer and invoice number; each line is a whole invoice." The legacy system splits some invoices into installments under one invoice number, and every row of such an invoice was refused.
    • "The customer is on hold for all transactions, or on hold for invoicing and the line is a debit." Credit control put a few customers on hold after the rehearsal extract was taken.

    The other rows were written: ten open journals exist, and in staging each grouping key is replaced by the number of the journal its lines went to. See I want to see why lines were refused and resend only those.

  3. Malia decides that each installment becomes an invoice of its own, numbered with a suffix such as LEG-209140-1, with its own amount and due date. Credit control lifts the invoicing hold on the held customers until the journals are posted.

  4. Jordan builds a file of the refused rows only. Each row gets, in JournalNumber, the journal its grouping key received (read from the Completed rows), and keeps its line number, which was never used; the extra installment rows get new line numbers above the highest in the file. Jordan does not resend the whole file: its grouping keys name no journal, so every row would go into new journals a second time. Line numbers stop duplicates only inside a journal that exists. The second execution is Succeeded.

  5. The stock file goes through Inventory journal lines (set-based) the same way and is Succeeded at the first run: two open movement journals, one per warehouse.

  6. Malia samples the journals on General ledger > Journal entries > General journals and **Inventory management

    Journal entries > Items > Movement**: line counts per journal match the extract's counts per grouping key.

Sunday: posting in the background​

  1. Jordan's script queues each of the twelve journals with submitAsyncOperation: postLedgerJournal for the customer invoice journals and postInventoryJournal for the movement journals. Asynchronous operations run in batch, where the standard posts a ledger journal above the ledger journal line limit, and each one runs as its own batch job. Every submission has its own RequestId, and its payload a second one for the posting, both stored in Jordan's run sheet:

    {
    "_request": {
    "RequestId": "<submission GUID>",
    "LegalEntityId": "USMF",
    "ServiceName": "MGCLatticeJournalPostingService",
    "OperationName": "postLedgerJournal",
    "RequestPayload": "{\"RequestId\":\"<posting GUID>\",\"LegalEntityId\":\"USMF\",\"JournalNum\":\"<journal>\"}"
    }
    }

    See I want to post the journals I imported and Post an existing journal.

  2. At 02:00 Jordan's VPN drops part way through the submissions. Jordan runs the script again with the same run sheet: the submissions already queued answer with their first TrackingId and queue nothing, and the rest are queued. See I want to run a long posting in the background and collect the result.

  3. The script polls getAsyncOperationStatus until every operation answers Status 3 (Succeeded), with the journal number in DocumentId, and Jordan follows them on the Async operations tab of System administration > Inquiries > Lattice > Integration operations > Inbound message inquiry. A failed posting would have gone to the dead-letter queue: retried automatically when retryable, otherwise parked with Integration item parked raised, and retried with Retry now on Integration operations console by an Integration administrator after the fix. A retry reuses the payload's RequestId, so it never posts twice. See I want to check an asynchronous operation and Lattice Async Operation Processing.

Monday 07:00: reconcile​

  1. Jordan exports LatticeCustomerTransactions for USMF in an export project and compares, per customer, the count of InvoiceId values and the total of TransactionCurrencyAmount with the legacy aged receivables. Every installment shows as its own invoice. See I want to read data back to reconcile a migration.
  2. Jordan reads LatticeInventoryOnHands with cross-company=true and $filter=dataAreaId eq 'usmf', and compares PhysicalInventoryQuantity per ItemNumber, InventorySiteId and InventoryWarehouseId with the legacy stock list.
  3. Malia reads LatticeGeneralLedgerEntries filtered on the clearing account's MainAccountId and LegalEntityId eq 'USMF': the receivables and the stock value landed there, matching the legacy totals.
  4. In staging, every row of the three executions is Completed or Error, none is left Not started, and every Error row has a Completed row in the resend. Credit control puts the held customers back on hold, and Malia signs off.

What changed​

  • The weekend had room to spare. The imports wrote the journals in one pass each, so the time went into checking, not waiting.
  • Bad rows cost minutes, not the load. The refused rows were listed with their reasons while everything else was written, and the resend went into the same journals without a single duplicate.
  • The posting survived a dropped connection. Every submission and every posting had its own request ID, so running the script again queued nothing twice.
  • Sign-off rested on figures. Customer balances, stock and the clearing account were read back from Finance and Operations and matched to the legacy reports.

For the business: collections started on Monday with every open invoice in place, and no customer was asked to pay an invoice twice.

Try it yourself​

In a sandbox with the USMF demo data, as a user with Integration operator and data management access:

  1. Build a three-row file for Customer invoice journal lines (set-based) with grouping key AR-TEST, journal name GenJrn, customer US-001 and an offset main account that allows manual entry, two of the rows with the same invoice number.
  2. Import it in batch: both rows with the shared invoice number are Error, and one new journal holds the third.
  3. Give one of the refused rows a new invoice number and that journal's number in JournalNumber, and import it: the journal now holds two lines.
  4. Post the journal with postLedgerJournal on /api/services/MGCLatticeJournalPostingServiceGroup/MGCLatticeJournalPostingService/postLedgerJournal, then read LatticeCustomerTransactions with cross-company=true and $filter=dataAreaId eq 'usmf' and CustomerAccount eq 'US-001'. See Import journals in bulk.