Automatically Printing Labels with a Post-Submit Procedure and NiceLabel Automation

Automatically Printing Labels with a Post-Submit Procedure and NiceLabel Automation

Automatically Printing Labels with a Post-Submit Procedure and NiceLabel Automation

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.


How It Works

The flow has five steps:

  1. A user fulfills a sales order on the handheld (a Fulfill Order transaction) and submits it.
  2. After the order is submitted, PanatrackerGP runs the post-submit stored procedure registered for that transaction.
  3. The procedure reads the fulfilled order and writes one row per fulfilled unit — the item, quantity, tracking, and order details, plus the target printer and number of copies — into the label table you create in Part 1.
  4. NiceLabel Automation watches the table with a Database Trigger and detects the new rows on its next poll.
  5. NiceLabel Automation prints a label for each row to the specified printer, then deletes the row.
NOTE: Nothing about the flow uses PanatrackerGP's standard label printing. The SQL table is a simple hand-off queue between your procedure and NiceLabel Automation.

What You Need

  • The Fulfill Order transaction needs to be enabled in PanatrackerGP (or the specific transaction you want to print labels for).
  • NiceLabel Automation (Pro or Enterprise) installed, with a label template designed.
  • SQL Server Management Studio (SSMS) access to the GP company database (the database that holds the PanatrackerGP7_Trx tables).

Part 1 — Create the Label Table

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).

IMPORTANT: Give the table a primary key. NiceLabel Automation deletes each row as it prints it (see Part 4), and it needs a primary key to delete rows one at a time. Without a primary key, NiceLabel deletes every row it fetched at once — which risks losing rows if a print fails partway through. A simple auto-incrementing 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
)
TIP: Use one table per label type. Keeping each label flow in its own table makes the NiceLabel Automation configuration simpler and avoids one flow's rows interfering with another's.

Part 2 — Write the Post-Submit Procedure

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
NOTE: This example writes column values in full, without table aliases, so it is clear which table each value comes from — the unit table (PanatrackerGP7_TrxFulfillOrderUnit), the order header (PanatrackerGP7_TrxFulfillOrder), or the GP item master (IV00101).
TIP: The 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.
TIP: Always 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.
NOTE: Do not insert the 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).

Part 3 — Register the Procedure in the Portal

Tell PanatrackerGP to run your procedure after the transaction is submitted:

  1. Deploy the procedure to the GP company database in SSMS, and grant execute permission to the account PanatrackerGP uses to connect to that database.
  2. In the Portal, go to Configure → Transaction Setup.
  3. Find the row for your transaction (for example Fulfill Order), click Edit, and set the Post Submit Stored Procedure field to your procedure's name (PanatrackerGP7_PostFulfillOrderLabel). Save.
  4. Submit a test transaction to confirm the procedure runs and rows appear in the label table.
NOTE: The Transaction Setup page also controls sequence numbering and the Auto-Submit toggle. These settings are normally configured once at installation and rarely changed — adjust only the Post Submit Stored Procedure field for this transaction, and contact your implementation engineer if you are unsure.
TIP: Only licensed, non–system-controlled transactions appear in Transaction Setup. If your transaction is not listed, confirm it is licensed.

Part 4 — Configure NiceLabel Automation

In NiceLabel Automation Builder, create a configuration with a Database Trigger that watches your label table.

Create the Database Trigger

  1. Add a new Database Trigger and give it a Name and Description.
  2. Under Database connection, click Define and configure the connection: database type SQL Server, the server, the GP company database, and the credentials NiceLabel should use. Select your label table (PanatrackerGP7_LabelFulfillOrder).
  3. Set Check database in the time intervals to how often NiceLabel should poll for new rows (for example, every few seconds).

Set the detection method to Get + Delete

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.

IMPORTANT: The 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.

Map the data and print the label

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:

  1. Set Printer — set the printer to the record's 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.)
  2. Open Label — select the label template to print.
  3. Print Label — set the quantity to the record's PrintQuantity field.

Map the remaining columns (ItemCode, ItemDescription, SalesOrderCode, and so on) to the matching variables on your label.

TIP: If your table columns are named the same as your label variables, NiceLabel's auto-mapping links them for you — no manual mapping needed.

Save the configuration and start the trigger in NiceLabel Automation Manager. It must be running for labels to print.


Part 5 — Test End to End

Test in two stages so you can tell which side of the hand-off has a problem:

  1. NiceLabel side. Insert a test row directly into the label table in SSMS, then confirm NiceLabel prints the label and the row disappears from the table:
    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)
  2. Procedure side. Submit a real Fulfill Order from the handheld and confirm rows land in the table and the labels print. You can also run the procedure directly against a submitted order's Oid:
    -- 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

Troubleshooting

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

  • Setting Up FlexField Lookups — capturing operator input (such as a printer choice or number of copies) in a FlexField your post-submit procedure can read.
    • Related Articles

    • Automated Labels Aren't Printing

      Symptom Your automated labels have stopped printing. Solution 1. Access the PanatrackerGP Server Remote into the server hosting PanatrackerGP using an administrator account. 2. Locate the NiceLabel Application On the server, open the Start menu and ...
    • Set up your Labels

      This guide walks through the complete setup process for automated label printing with PanatrackerGP, including printer configuration, NiceLabel software installation, and label template customization. Setting Up Your Label Printer An Ethernet-enabled ...
    • PanatrackerGP Automatic Label Printing Overview

      PanatrackerGP automates label printing for inventory transactions using NiceLabel Automation Manager. When users complete transactions on handheld devices, the portal generates print jobs that Automation Manager processes automatically, printing ...
    • Getting started with Label Printing

      PanatrackerGP automatically prints item labels from many transactions based on configuration setup. Overview Label printing requires a third-party label printing solution. Panatrack recommends NiceLabel. BarTender label software can also be used. How ...
    • Can we print GS1-128 (aka UCC-128) barcode labels with PanatrackerGP?

      GS1-128 barcode labels (formerly UCC-128) are used in shipping to match Advanced Shipping Notices (ASN) for many large companies. Retailers and distributors often require these labels on shipments, prompting questions about printing them with ...