Recipe: Lot Hold
Lot Hold
Free recipe. Given one container serial number, Lot Hold traces every downstream container produced from it, places each one on hold in Plex, and generates a barcoded hold document that quality and production can sign.
What's in the recipe
| Object | Name | Purpose |
|---|---|---|
| Script | LotHold | Traces the container tree, applies the hold, assembles the document payload |
| Document template | Lot Hold | Renders the hold document to PDF, one barcoded row per held container |
| Automation | Launch from a Plex container screen | Passes the serial number in as a URL parameter and opens the generated PDF |
Plex data sources used
| Key | Name | Purpose | Side effects |
|---|---|---|---|
| 24120 | Container_Trace_Children_Get | Returns every downstream serial, at every level | read-only |
| 6556 | Container detail | Full container record for one serial | read-only |
| 4964 | Container status update | Sets Container_Status to Hold with a disposition note | writes |
Check these before you run anything. Data source keys are not portable between tenants. Only about 15% of the Plex catalog is callable by any given tenant, and the enabled set differs by credential. Confirm all three keys against your own tenant first.
Important: Serial_No vs Tracking_No
This is the single most important thing to understand about this recipe, and it will affect anything else you build against Plex container data.
Data source 6556 does not return a Serial_No field at all. It returns Tracking_No, which is the serial of the tracking or parent container. That value is shared across every sibling container produced from the same tracking unit.
Verified example: a source coil with 24 downstream containers resolved to only 12 distinct Tracking_No values. Four separate containers — SJ009679, SJ009680, SJ009681 and SJ009682 — all report a Tracking_No of SJ009681.
The true serial number exists only in the output of data source 24120. The script therefore stamps the queried serial back onto each detail row before the template ever sees it:
var row = rows[0];
row.Serial_No = Serial; // DS 6556 does not return this
return row;
If you render Tracking_No in a column labelled "Serial", the document will show duplicate numbers and under-report the containers actually held. If you have other reports or traceability documents built on Tracking_No, check them for the same defect.
Installation
- Install the Lot Hold recipe from the recipe library.
- Map the three Plex data sources above to the keys enabled on your tenant.
- Set
CRED_NAMEandCOMPANY_CODEat the top of the script to your Plex credential and company code. - Adjust
COMPANY_NAME— it feeds the document header and footer. - Attach the automation to whichever Plex container screen your quality team already uses. The script reads the serial from
screenInfo.urlParams.SerialNo, and also acceptsparameters.SerialNofor scheduled or manual runs. - Run it against a single container in your test environment before enabling it in production.
How it behaves
- The source container is held first, then re-read, so the document reflects the status it actually landed on rather than the status before the write.
- Inactive containers still appear. A consumed or closed container cannot be put on hold, but it is listed and flagged rather than dropped. A silent gap in an audit trail is worse than a visible exception.
- Containers that cannot be read appear in their own section at the bottom of the document, with the reason. Verify these manually before releasing a hold.
- Duplicates are removed — a container appearing at more than one level of the trace is held and printed once.
- Rows are sorted by serial, so a reprint matches the original page for page.
The document
The template renders a summary strip (containers affected, placed on hold, inactive, unreadable), the disposition note, and one row per container with a scannable code128 barcode of its serial. Tracking No is kept as its own de-emphasized column so the parent-child relationship stays visible. Quality and production signature lines close the page.
Header and footer are set inline on the template so the company name and document title resolve correctly. If you would rather inherit your own company defaults, change headerSource back to company_default and make sure your default header markup has values for CompanyName and DocumentTitle — the script supplies both in its payload.
Extending it
- Add a column by adding a cell to the loop in the template. The payload carries the full Plex container record, so most fields are already available.
- To email the document on generation, add a send step after the document call and reuse the existing report notification email template.
- To restrict who can place a hold, gate the automation behind a permission.
Documentation drafted with AI assistance. Review before relying on it.