RE: Advanced PDF/HTML Template – Item Fulfillment
I am building a custom Picking Ticket using a NetSuite Advanced PDF/HTML Template and am trying to display the quantity remaining to fulfil on each Sales Order line.
What I need is:
Remaining to Fulfil = Quantity Ordered – Quantity Fulfilled
Example:
- Ordered = 400
- Fulfilled = 300
- Remaining = 100
The problem is that although the Sales Order screen clearly shows a “Fulfilled” column, I cannot find the correct Advanced PDF field ID to access that value.
I have tested many fields in the item loop (<#list record.item as item>) including:
${item.quantityfulfilled}
${item.fulfilled}
${item.fulfilledquantity}
${item.fulfilledqty}
${item.quantityremaining}
${item.remainingquantity}
${item.quantitypicked}
${item.quantityshipped}
${item.itemfulfilled}
${item.itemfulfillment}
All returned blank.
I have confirmed that the following fields DO work in the Advanced PDF template:
${item.quantity}
${item.quantityonhand}
${item.description}
My questions are:
- Is there a field available in Advanced PDF templates that returns the Sales Order line’s Fulfilled quantity?
- Has anyone successfully displayed “Remaining to Fulfil” on a Picking Ticket?
- Is this data unavailable in Advanced PDF templates, requiring a custom transaction line field/workflow/script instead?
Any examples of working field IDs or template code would be greatly appreciated.
The reason every one of those field IDs came back blank isn’t naming, it’s that “fulfilled quantity” doesn’t live on the Sales Order line at all. It’s a rollup calculated from however many child Item Fulfillment records exist against that line, which is why the SO screen can show it (the UI reaches across records to compute it) but the Advanced PDF/HTML engine can’t (it binds to a fixed set of fields on the transaction being printed, it doesn’t reach out to child transactions on its own).
A couple of paths, in order of effort:
1. Worth testing first: ${item.quantitybackordered} is a native, stored field on the SO line (not derived at print time the same way), and in most non-complicated fulfillment scenarios, Remaining to Fulfill ends up being equal or very close to quantity backordered. Test it against a partially fulfilled line and confirm the math lines up for your fulfillment/backorder settings before relying on it, it can diverge if you’re using holds, partial commits, or drop ship/special order lines mixed in.
2. If that doesn’t hold up cleanly, the standard, deterministic fix is a custom transaction column field on the Sales Order (e.g., custcol_qty_remaining), populated by a User Event script on Item Fulfillment (afterSubmit, on create and edit) that recalculates Ordered minus the sum of Fulfilled across all linked fulfillments and writes it back to the corresponding SO line. Reference that custom field’s ID directly in your template (${item.custcol_qty_remaining}). This is fully testable and debuggable since the value is sitting on the record, not being calculated inside the template engine.
3. To answer your third question directly: yes, this is a case where Advanced PDF alone isn’t enough, it can only render what’s bound to the record, it can’t do a live cross-record rollup itself. If you want it computed fresh at print time instead of stored/synced via script, you’d generate the PDF via a Suitelet using the N/render module, calculate quantity remaining yourself in the script by querying Item Fulfillments for that SO, and pass it into the template as part of a custom data object rather than relying on record.item. More setup, but it avoids any risk of a stored field going stale if a fulfillment gets deleted or edited later.
Start with option 1 since it’s free to test, fall back to option 2 if the math doesn’t hold across your edge cases.