This guide shows how to automatically print a label whenever a PanatrackerGP transaction is submitted, using a post-submit stored procedure together with NiceLabel Automation. The procedure gathers the label data and writes it to a SQL table; NiceLabel Automation watches that table and prints the label to the printer you specify.
This approach is independent of PanatrackerGP's built-in label printing. PanatrackerGP's job is to run your procedure and write a row to the label table; the printing itself is handled entirely by NiceLabel Automation, providing a flexible way to print custom labels for any transaction without changing PanatrackerGP.
The example below uses the Fulfill Order transaction — printing a label for each item fulfilled on a sales order — but the same pattern works for any transaction.
The flow has five steps:
PanatrackerGP7_Trx tables).Create a dedicated table that your procedure writes to and NiceLabel Automation monitors. It holds the fields your label needs, plus the target printer and print quantity (number of copies).
Id column is all you need; your procedure never has to set it.
CREATE TABLE PanatrackerGP7_LabelFulfillOrder (
Id INT IDENTITY(1,1) PRIMARY KEY, -- key field for NiceLabel to delete on
SalesOrderCode nvarchar(40),
TransactionCode nvarchar(40),
ItemCode nvarchar(60),
ItemDescription nvarchar(200),
ItemShortName nvarchar(30),
SiteCode nvarchar(20),
BinCode nvarchar(40),
Quantity numeric(19,5), -- quantity printed on the label
UnitOfMeasure nvarchar(16),
ItemTrackingOption nvarchar(10), -- Bulk / Serial / Lot
SerialCode nvarchar(60),
LotCode nvarchar(60),
Printer nvarchar(255), -- target printer name
PrintQuantity int -- how many label copies to print
)
The procedure follows the standard post-submit contract: it takes a single @TrxOid UNIQUEIDENTIFIER parameter and returns nothing. For a Fulfill Order, PanatrackerGP passes the Oid of the order header that was just submitted. The procedure joins the fulfilled units to their order header, filters on that Oid, and inserts one row per fulfilled unit into the label table.
CREATE PROCEDURE PanatrackerGP7_PostFulfillOrderLabel
@TrxOid UNIQUEIDENTIFIER
AS
INSERT INTO PanatrackerGP7_LabelFulfillOrder
(SalesOrderCode, TransactionCode, ItemCode, ItemDescription, ItemShortName,
SiteCode, BinCode, Quantity, UnitOfMeasure, ItemTrackingOption,
SerialCode, LotCode, Printer, PrintQuantity)
SELECT
ISNULL(PanatrackerGP7_TrxFulfillOrder.SalesOrderCode, ''),
PanatrackerGP7_TrxFulfillOrder.TransactionCode,
PanatrackerGP7_TrxFulfillOrderUnit.ItemCode,
PanatrackerGP7_TrxFulfillOrderUnit.ItemDescription,
ISNULL(RTRIM(IV00101.ITMSHNAM), 'N/A'),
PanatrackerGP7_TrxFulfillOrderUnit.SiteCode,
PanatrackerGP7_TrxFulfillOrderUnit.BinCode,
PanatrackerGP7_TrxFulfillOrderUnit.FulfilledQuantity,
PanatrackerGP7_TrxFulfillOrderUnit.UnitOfMeasure,
CASE PanatrackerGP7_TrxFulfillOrderUnit.TrackingOption
WHEN 1 THEN 'Bulk' WHEN 2 THEN 'Serial' WHEN 3 THEN 'Lot' END,
PanatrackerGP7_TrxFulfillOrderUnit.SerialCode,
PanatrackerGP7_TrxFulfillOrderUnit.LotCode,
'FulfillmentPrinter', -- static printer name (see note below)
1 -- one label copy per fulfilled unit
FROM PanatrackerGP7_TrxFulfillOrderUnit
INNER JOIN PanatrackerGP7_TrxFulfillOrder
ON PanatrackerGP7_TrxFulfillOrderUnit.TrxFulfillOrderOid = PanatrackerGP7_TrxFulfillOrder.Oid
LEFT JOIN IV00101
ON PanatrackerGP7_TrxFulfillOrderUnit.ItemCode = IV00101.ITEMNMBR
WHERE PanatrackerGP7_TrxFulfillOrder.Oid = @TrxOid
PanatrackerGP7_TrxFulfillOrderUnit), the order header (PanatrackerGP7_TrxFulfillOrder), or the GP item master (IV00101).
Printer value can be static or dynamic. Above it is a fixed name (static) — every label from this transaction goes to the same printer. To let the operator choose the printer at fulfillment time (dynamic), capture their selection in a transaction FlexField and read that column here instead of the literal value. See Setting Up FlexField Lookups.
RTRIM() values read from native GP tables (like IV00101). GP stores them in fixed-width char columns padded with trailing spaces, which otherwise print on the label.
Id column, it fills in automatically. Note the difference between Quantity (the amount printed on the label) and PrintQuantity (how many copies of the label to print).
Tell PanatrackerGP to run your procedure after the transaction is submitted:
PanatrackerGP7_PostFulfillOrderLabel). Save.In NiceLabel Automation Builder, create a configuration with a Database Trigger that watches your label table.
PanatrackerGP7_LabelFulfillOrder).Under Detection Options, choose Get records and delete them. Specify the table name and set the key field to Id. NiceLabel then deletes each row with DELETE FROM PanatrackerGP7_LabelFulfillOrder WHERE Id = :Id as it prints it — one row at a time.
Id primary key from Part 1 is what makes this safe. With a key field set, NiceLabel deletes rows individually as they print; without one it deletes the whole fetched batch at once. Always set the key field.
When NiceLabel detects records, the Action tab shows a For Each Record action. Nest your print actions inside it so they run for every new row:
Printer field so each label prints to the printer named on the row. (You can instead hard-code a single printer here if every label goes to the same device.)PrintQuantity field.Map the remaining columns (ItemCode, ItemDescription, SalesOrderCode, and so on) to the matching variables on your label.
Save the configuration and start the trigger in NiceLabel Automation Manager. It must be running for labels to print.
Test in two stages so you can tell which side of the hand-off has a problem:
INSERT INTO PanatrackerGP7_LabelFulfillOrder
(SalesOrderCode, TransactionCode, ItemCode, ItemDescription, ItemShortName,
SiteCode, BinCode, Quantity, UnitOfMeasure, ItemTrackingOption,
SerialCode, LotCode, Printer, PrintQuantity)
VALUES
('SO-TEST', 'ORD-TEST', 'TEST-ITEM', 'Test Item', 'TESTITM',
'MAIN', 'A-01', 1, 'EACH', 'Bulk',
'', '', 'FulfillmentPrinter', 1)-- find a recent fulfilled order's Oid SELECT TOP 10 Oid, TransactionCode FROM PanatrackerGP7_TrxFulfillOrder ORDER BY SubmitTime DESC DECLARE @TrxOid UNIQUEIDENTIFIER = '00000000-0000-0000-0000-000000000000' -- paste an Oid EXEC PanatrackerGP7_PostFulfillOrderLabel @TrxOid
| Symptom | What to check |
|---|---|
| Nothing prints | Confirm the trigger is running in NiceLabel Automation Manager, then check that rows land in the label table after a submit (SELECT * FROM PanatrackerGP7_LabelFulfillOrder). If rows appear but nothing prints, the issue is on the NiceLabel side (connection, mapping, or printer); if no rows appear, the issue is the procedure. |
| Rows pile up and never delete | The detection method is not Get records and delete them, or the key field is not set to Id. |
| Transaction shows a Warning after submitting | The post-submit procedure raised an error. The submit completed, only the procedure failed. Run the procedure in SSMS against that order's Oid to see the error, and add NULL / edge-case handling. |
| Label prints to the wrong printer (or not at all) | The Printer value written to the row must match a printer NiceLabel Automation can reach. Confirm the Set Printer action is mapped to the Printer field, and that the value is a valid printer name. |
| The procedure never runs | Confirm it is registered on that exact transaction in Configure → Transaction Setup, and that the transaction is licensed and not system-controlled. |
| Trailing spaces on the label | Wrap any value read from a native GP char column (such as those in IV00101) in RTRIM() so the trailing spaces GP pads them with do not print on the label. |
Questions? Contact Panatrack Support.
Related articles