Fix repeated sales order rows from a purchase order join in NetSuite

Compare purchase order detail and header matches in a sales order saved search, keep separate SO lines, and retain the linked PO document number.

The quick answer

If the Purchase Order join returns multiple PO-side rows for a sales order line, restrict Purchase Order Fields... > Main Line to Yes. Keep the base sales order’s Main Line, Tax Line, Shipping Line, and COGS Line set to No. Compare the same SO line keys and linked PO numbers before and after. This restricts the joined PO to its header; it does not guarantee one row per SO line in every search.

This example uses fictional people, company names, and demonstration records. It compares joined PO detail matches with joined PO header matches. Your account’s stored relationships determine which rows appear.

Before you start

You need permission to edit a Transaction saved search and view the linked sales orders and purchase orders. The account must expose the Purchase Order join and its Main Line field. Available fields and menu labels can vary with role, enabled features, and transaction setup.

The example starts with an existing search named Sales Order Lines and Linked Purchase Orders. It has Type = Sales Order, the four base line flags set to No, and Purchase Order : Main Line = No. The joined criterion deliberately selects PO detail matches so the comparison is clear. It uses stored transaction links, such as supported drop-ship or special-order relationships. It does not find unrelated POs with the same item.

The starting joined PO criterion selects detail matches for the comparison.

This search covers linked SO lines. A criterion on the joined PO generally requires a matching PO, so unmatched sales order lines may be excluded.

01. Inspect the repeated lines

Preview the existing search. Compare Document Number, Line Unique Key, Item, Quantity, and Purchase Order : Document Number.

With Purchase Order : Main Line = No, SO4102 has four result rows: line key 81001 appears twice, and 81002 appears twice. Both refer to PO6204. Because the joined criterion selects PO detail rows, this is a controlled view of multiple PO-side matches for the same SO lines.

Four joined detail matches repeat two sales order line keys.

A repeated document number alone does not identify an error: one sales order can legitimately have several item lines. The line key lets you distinguish those lines from repeated matches.

02. Restrict the purchase order join

Click Return To Criteria. Edit the existing Purchase Order : Main Line criterion. Select Yes, then click Set. Keep the base Main Line = No criterion.

Change the joined purchase order criterion to Yes.

Confirm that Purchase Order : Main Line now reads is true, while the base Main Line remains is false. The base criterion keeps SO item lines; the joined criterion selects the PO header.

The changed criterion applies to the PO side of the join.

03. Compare the preview

Preview again. The example now returns two rows. Line keys 81001 and 81002 remain separate, with their original items and quantities: Mounting plate, 4 and Anchor bracket, 6. PO6204 remains in the joined Document Number column.

Both sales order lines remain after restricting the PO side to its header.

No summary grouping was used. If a line still repeats, inspect its actual PO relationships and every other one-to-many join in the search. If a needed line disappears, check whether it has a matching PO before changing the search to hide the difference.

Return to the criteria and click Save to save and run this existing search. Confirm the saved result has the same two SO line keys and retains PO6204 on both rows.

The linked PO document number remains on the saved result.

Validate the resulting row grain against the underlying records before using the search for quantities or financial reporting. Use a separate SO-line search without the joined PO criterion when you need to reconcile lines with no related PO.

Common questions

Why don’t the four base line filters remove every repeated row?

Base Main Line, Tax Line, Shipping Line, and COGS Line criteria select sales order line rows. They do not limit how many matching rows a related purchase order join contributes.

Why not group by the sales order number?

Grouping changes the search into a summary search. It can merge distinct SO lines or hide multiple PO relationships. Use summary types when aggregation is the reporting goal, and define how each item, quantity, and related transaction should be represented.

Is PO/Check Number the internal purchase order number?

On a Sales Order, PO/Check Number is the customer’s reference. Use Purchase Order Fields > Document Number for the related internal purchase order transaction number.

Will this include sales order lines without purchase orders?

A joined PO criterion generally requires a matching purchase order, so unmatched SO lines may be excluded. This example does not demonstrate an unmatched-line workaround. Use a separate SO-line search without the joined PO criterion when completeness is required.

Why can a sales order line still appear more than once?

It may have multiple genuine related PO headers, or another one-to-many join may be multiplying the result. Inspect the relationships and field paths before suppressing rows.