Lead Time flow 1 — First and second arrival into Sydney

Lead time is the promise the customer reads on the website: how long after ordering they will get the item. It is worked out in NetSuite and pushed to Shopify by Celigo flows that run in order. This entry is flow 1: it works out the next two times sellable stock lands in Sydney, and records them on the product. Flow 2 turns the first of those dates into the customer-facing lead time and sends it to Shopify; flow 3 does the same for kits.

Active, and rebuilt in September 2026. The automation this entry used to describe — one arrival date per warehouse, from saved search 7173 — was switched off on 2026-09-18 and replaced. Everything below describes the replacement, verified against Celigo and NetSuite on 2026-09-21. Celigo has no commit to pin an entry to, so this entry is verified by export date and review instead — see Source references.

Rules & IDs

Rule ID Rule Reading
LI-BL-INV-005 Which supply counts, and when it lands in Sydney Business logic
LI-BL-INV-014 The first and second arrival Business logic

Project owner
Kim Hoang Nguyen
Developer
Kim Hoang Nguyen
For department
Back End Team
Status
active
Documented
created 2026-08-17 · updated 2026-09-28this registry entry
Script created / updated
created 2026-09-17 · updated 2026-09-17from Celigo — script 6aab4c10
Verified against production
2026-09-23no version control — verified by re-reading the flow
Systems touched
celigonetsuite
Rules
Terms

Three readings of the same rules. Nothing is duplicated between them. Printing gives you the business reading followed by the diagrams.

Why it exists. The lead time on a product page is what a customer decides to buy on. Too short and the order is late and the customer was misled; too long and the sale goes to a competitor who quoted the truth. NetSuite knows what stock is coming and when; Shopify is where the customer looks. This chain keeps the two saying the same thing.

Until September 2026 it recorded a single arrival date per warehouse, which answered "when is more stock due" but not "how much of it can I actually sell, and what comes after that". Buying and sales were doing that arithmetic by hand, off a spreadsheet. This rebuild does it in the system.

Who it affects. Customers first, because the first arrival date becomes the promise they read before ordering. Buying and sales read the quantities and the second arrival directly, to decide what to promise a waiting customer and what to re-order.

Who owns it when it goes wrong. Confirmed by the project owner on 2026-09-23, and it splits by cause, not by system — which matters, because most of what looks like a lead-time bug is a data problem:

The problem is… Owner Examples
Technical, or the calculation is wrong Back End Team The wrong arrival was picked; a quantity is miscalculated; the flow errored; a page of products was skipped
A purchase order carries incorrect data Buying Team An expected receipt date nobody maintains; a stage never moved on; a line that should have been closed; a supplier or lead time missing from the item

The practical test: if correcting the purchase order in NetSuite would fix it, it is Buying's. If the purchase order is right and the answer is still wrong, it is Back End's. Everything in this entry's defect table is the second kind.

When it runs. Six times a day, Sydney time — 12:05am, 4:05am, 8:05am, 12:05pm, 4:05pm and 8:05pm, every four hours. It is not triggered by anyone saving a record, so an order changed just after a run waits up to four hours before the website reflects it. When it finishes it starts flow 2 automatically, whether or not anything was written.

How it decides.

  • It lists every open line of incoming stock — Sydney purchase orders, bonded purchase orders, and transfer orders arriving into Sydney — and works out, for each, how many units are genuinely still free to sell.
  • Stock already promised to a customer does not count. What is left is the sellable quantity, and a line with none of it is dropped.
  • Each source gets a date. A Sydney order arrives on its own date; a transfer order arrives on its own date; bonded stock is dated 35 days later than its Vietnam date, because that is how long it takes to reach Sydney.
  • Anything more than a fortnight overdue is treated as not coming, and the next source takes its place.
  • The surviving sources are sorted earliest first. The first is the product's first arrival, the next is its second arrival; each carries its own quantity.
  • Nothing is written unless one of the six recorded values has actually moved.

Outcomes. The product's two arrival dates and quantities are updated and flow 2 starts · the product is skipped because nothing changed — around 95% of products on a typical run · a product with no inbound stock left is never on the report at all, so its old values stay on it, which is a known limitation, not a decision.

The chain, in order.

# Flow What it settles
1 First and second arrival The next two times sellable stock lands in Sydney, with the quantity on each, and the raw bonded date.
2 Inventory items Turns the first arrival into the lead time on each stocked product, then sends it to Shopify.
3 Kit items The same promise for a kit, rolled up from its members. Started by flow 2.

Which supply counts, and when it lands in Sydney LI-BL-INV-005

What it does. Turns every open line of incoming stock into a single answer: how many units can we still sell off this line, and when do they land in Sydney. Everything else in the chain is built on that answer.

Where stock lives, and how it behaves.

Place Sellable today? How it reaches a customer
Sydney Warehouse Yes Ships directly
Sydney Overflow Yes Counts as Sydney stock. Never counted as incoming
Bonded Warehouse, Vietnam No Must cross to Sydney first — around 35 days
Showrooms No Display stock, not sellable online

How much of a line is sellable. Units still to be received, less the units NetSuite has already matched to customer orders, and never below zero. Backorders NetSuite has not yet matched to a line are not deducted — a deliberate choice, so the figure matches what NetSuite itself shows on the order.

When each kind of supply lands.

Supply Its arrival date
Sydney purchase order The order's own expected receipt date
Transfer order, bonded into Sydney The transfer order's own expected receipt date, with nothing added — it is already a planned move, and the date is already right
Bonded purchase order The order's Vietnam date plus 35 days. Units already claimed by a transfer order are excluded here and counted on that transfer order instead, so they are never promised twice
Bonded stock on hand, no transfer order raised Today plus 35 days, so it rolls forward every run until a transfer order exists

Only bonded-to-Sydney transfer orders count as incoming. A transfer order moving stock to overflow or to a showroom is not new supply — it is stock we already had. The rule is confirmed; the report does not yet enforce it, which is a known defect.

Bonded stock on hand is not settled here. It is a stock balance, not an order, so it has no line on this report and this flow cannot see it. Flow 2 contributes that one date instead — see LI-BL-INV-011. The rule is recorded here because this is where the supply rules live; the place it runs is flow 2.

A separate bonded date, recorded raw. Alongside the two arrivals, the product carries the earliest date any open bonded purchase order is due into Vietnam — with no transit added, and including lines already claimed by a transfer order. It is a different question from "when can I sell it", and it is what the kit flow reads.

Outcomes. Every open line becomes a dated, quantified source · a line with nothing left to sell is dropped · supply at any location other than Sydney or bonded contributes nothing at all.

The first and second arrival LI-BL-INV-014

What it does. Takes the dated sources from LI-BL-INV-005, picks the two that matter, and records them on the product with their quantities.

How the two are chosen.

# Step Why
1 Drop any source with nothing left to sell, or no date It cannot be promised to anyone
2 Drop any source more than 14 days overdue; the next one takes its place A date a fortnight past is not a date, it is a stalled shipment
3 Merge sources of the same kind arriving on the same day, adding their quantities. The merged entry takes its stage from whichever contributed most Two purchase orders landing together are one arrival to a customer
4 Sources of different kinds on the same day stay separate, with the transfer order first A planned move beats an estimate
5 Sort earliest first. The first is the first arrival, the second is the second arrival —

The first arrival is never blank while the second holds a value. Confirmed as a rule by the project owner on 2026-09-22, and true across all 12,666 products checked on that date. It holds because the two slots are filled from one sorted list — the second can only exist if the first does — so when the first arrival is received or cancelled, the next one becomes the first on the following run. There is no separate promotion step.

A stale first arrival is dropped so the second takes its place. Confirmed by the project owner on 2026-09-23. When the first arrival goes more than a fortnight overdue its date is no longer worth quoting, so it leaves the list and the second arrival becomes the first. The purpose is that everything downstream only ever reads the first-arrival fields — the lead time never has to look at the second-arrival fields, or know that a promotion happened.

This is a configuration constant, not code. The alternative setting keeps a stale source in its slot and renders it blank, which would both break the rule above and force every consumer to fall back to the second-arrival fields. Dropping is fixed policy, and the constant should be treated as part of the rule rather than as a tunable.

What gets recorded. Six values: the first arrival's date, quantity and supply stage; the second arrival's date and quantity; and the raw bonded date from LI-BL-INV-005. The stage is blank when the first arrival is bonded stock on hand, because there is no order behind it to have a stage.

Only real changes are written. All six are compared against what the product already carries. If none has moved, the product is not touched — on a typical run around 1,240 products are examined and about 50 are written. A blank is a real value: when a source disappears, the blank is written and the field is cleared.

These quantities are not the website's, and they are not meant to add up to it. The first and second arrival quantities are per arrival — what is on that one shipment. The Quantity On Order a shopper sees is the total across every open purchase order, plus spare bonded stock and supplier stock, whichever slot they fall in. Confirmed by the project owner on 2026-09-23.

Worked example — Allocco King Bed (Slats): the first arrival carries 5 units on 25 September, the second carries 7 on 19 October, and Quantity On Order reads 30. The remaining 18 sit on a third and fourth purchase order that the two slots never reach. All three figures are correct.

Two numbers that look like they should reconcile, and do not, is exactly the kind of thing that gets reported as a bug. It is not one — they answer different questions.

Where to read them. Sales read the first and second arrival in Shopify. NetSuite holds the same values for debugging. That is the confirmed intent; the push to Shopify is not yet wired from this flow, and what flow 2 currently sends is incomplete — see Known defects.

Outcomes. The product carries its next two sellable arrivals · one arrival and a blank second · two blanks, when nothing sellable is inbound · the product is skipped entirely because nothing moved.


Field registry

Every field this automation reads or writes, by the name it carries in the system — what it means, and what changes when it changes. Field ids are in the developer reading.

Inputs — what it reads

Values the automation looks at to make its decision. Change one of these and the decision changes.

FieldWhat it meansWhat it changesStatus
Internal IDInventory Item Which product the incoming stock is for. Identifies the item to update. A row without it is passed through untouched and never updates anything. confirmed
Display NameInventory Item The product's name. Carried through for readability. Never used in a decision. confirmed
needs confirmingTransaction Line The warehouse the line's stock is heading to. Decides which supply bucket the line joins. `11` Sydney Warehouse and `25` Bonded Warehouse - Vietnam are the only two the rule acts on; every other location is ignored outright. confirmed
Document NumberTransaction The purchase order or transfer order number behind the line. Used to tell a purchase order from a transfer order: an all-digit number is a transfer order, a number starting `P` is a purchase order. Also recorded in the run's debug output. confirmed
Internal IDTransaction The order the line sits on. Half of the key used to recognise the same line twice in one page. Its presence is also what distinguishes an order line from an item-only row. confirmed
Expected Receipt DateTransaction Line The date the order expects this line's stock to be received. The arrival date for a Sydney line, taken as-is. For a bonded line it is the date before the transit uplift is added. confirmed
PO StageTransaction How far along the order is, in supply chain's own words. Copied to the item's PO Stage (1st PO) when this line wins the first slot. Returned as an internal id and written as an internal id — the 22 stage names behind those ids were read from NetSuite on 2026-09-23 and are recorded under Worked example. The search supplies no name column, which is defect LT1-D7. needs confirming
needs confirmingTransaction Line Units on the line still to be received — ordered less received. The starting quantity for the line. Sellable quantity is this less the quantity already allocated to customer orders. confirmed
needs confirmingTransaction Line Units on the line NetSuite has already matched to customer orders. Subtracted from the remaining quantity to give sellable quantity. On a bonded purchase order line this is mostly quantity claimed by a transfer order, which is why it is removed here and counted on the transfer order instead. confirmed
Receive Date (1st PO)Inventory Item The first-arrival date the product already carries. Compared against the newly calculated date. A difference on any one of the six compared values makes the whole product eligible for update. confirmed
Qty On Order Available (1st PO)Inventory Item The first-arrival quantity the product already carries. Compared against the newly calculated quantity. Blank and zero are treated as the same value. confirmed
PO Stage (1st PO)Inventory Item The stage the product already carries for its first arrival. Compared against the newly calculated stage. NetSuite's empty-list value `- None -` is treated as blank. confirmed
Receive Date (2nd PO)Inventory Item The second-arrival date the product already carries. Compared against the newly calculated date. confirmed
Qty On Order Available (2nd PO)Inventory Item The second-arrival quantity the product already carries. Compared against the newly calculated quantity. confirmed
Next Available Receive Date (Bonded WH)Inventory Item The bonded arrival date the product already carries. Compared against the newly calculated bonded date. confirmed
Receive Date (1st PO)Inventory Item The date the first sellable stock lands in Sydney. The date the rest of the chain is built on. Written whenever the product qualifies for update — including as a blank, which clears it. confirmed
Qty On Order Available (1st PO)Inventory Item Units on that first arrival still free to sell. Internal visibility for buying and sales. Deliberately not the same number as the website's Quantity On Order. confirmed
PO Stage (1st PO)Inventory Item The supply stage of the source behind the first arrival. Written as an internal id. Blank when the first arrival is bonded stock on hand, because there is no order behind it. confirmed
Receive Date (2nd PO)Inventory Item The date of the next sellable arrival after the first. Internal visibility for buying and sales. Nothing downstream reads it for a customer promise. confirmed
Qty On Order Available (2nd PO)Inventory Item Units on that second arrival still free to sell. Internal visibility for buying and sales. confirmed
Next Available Receive Date (Bonded WH)Inventory Item The earliest date any open bonded purchase order is due into Vietnam. Recorded raw — no transit added, and lines already claimed by a transfer order are included. The kit lead-time flow reads it. confirmed

Outputs — what it writes

Values the automation puts back. Everything downstream of this rule reads them, so a wrong value here travels.

FieldWhat it meansWhat it changesStatus
Receive Date (1st PO)Inventory Item The date the first sellable stock lands in Sydney. The date the rest of the chain is built on. Written whenever the product qualifies for update — including as a blank, which clears it. confirmed
Qty On Order Available (1st PO)Inventory Item Units on that first arrival still free to sell. Internal visibility for buying and sales. Deliberately not the same number as the website's Quantity On Order. confirmed
PO Stage (1st PO)Inventory Item The supply stage of the source behind the first arrival. Written as an internal id. Blank when the first arrival is bonded stock on hand, because there is no order behind it. confirmed
Receive Date (2nd PO)Inventory Item The date of the next sellable arrival after the first. Internal visibility for buying and sales. Nothing downstream reads it for a customer promise. confirmed
Qty On Order Available (2nd PO)Inventory Item Units on that second arrival still free to sell. Internal visibility for buying and sales. confirmed
Next Available Receive Date (Bonded WH)Inventory Item The earliest date any open bonded purchase order is due into Vietnam. Recorded raw — no transit added, and lines already claimed by a transfer order are included. The kit lead-time flow reads it. confirmed