Line-item-by-line-item matching across linked transactions in NetSuite can be a little unclear, so I wrote a script that should hopefully help make things a bit easier for end users.
Here’s the problem, in a nut shell… Let’s say you have a drop ship Sales Order that automatically gets converted into more than one Purchase Order – perhaps you have items on the sales order that are sourced from different vendors. You have 3 items total; two items go to vendor A, and the third item goes to vendor B. NetSuite will number the lines on the sales order – no problem. But take a look at the line numbers on the purchase orders. Each purchase order will number their lines staring with 1.
In the scenario above, you’ll have a SO with line numbers 1, 2 and 3, and a purchase order for vendor A will have line numbers 1 and 2. However, those line numbers don’t necessarily correspond to sales order line 1 and 2. They could be SO line numbers 1 and 3 or 2 and 3, while the purchase order for vendor B will have the remaining sales order line, but it will always have a line number of 1. This makes reconciliation between sales orders and associated purchase orders difficult. To make matters worse, let’s say you have EDI connections between NetSuite and vendors A and B. When they send you an ASN (EDI 855) or a vendor bill (EDI 810), tracing line items on these transactions back to the sales order line item can be a difficult task if you don’t send the original sales order line numbers to your vendors to begin with.
The way to solve this is to create a custom transaction column that is available to both sales items and purchase items, plus a few lines of code in a User Event script on the sales order approval event to create the line numbers:
Now, when the sales order is approved, the custom field will automatically flow downstream to the purchase order line items.
UPDATE:
We’ve modified this a bit to pass along the NetSuite-generated line numbers downstream to the purchase order. EDI enabled vendors will then use the sales order line numbers that copied from the sales order to the purchase order. When the ASN (fulfillment) comes back from the vendor, it will reference those same sale order line numbers so that we can line item match between sales order and fulfillment.
As line items get added and removed from the sales order prior to approval and purchase order creation, you can easily end up with line items that are not sequential at all – perhaps lines 1, 2, 5, 8, 11 or whatever the case may be. Now, all the associated documents can easily be reconciled.
Line #6 in the code reflects this change.