The situation
A distributor sells through a large dealer network, and its dealer programmes are more complex than NetSuite's native promotions can express. Discounts depend on volume tiers, product groups and promotion groups, and each order also has to get the best payment terms the dealer qualifies for. Sales operations applied all of this by hand, order by order. Three more jobs around the order were manual. Staff calculated rep commissions line by line, charged environmental handling fees that vary by the ship-to region, and corrected invoices that had gone out wrong.
What we built
A promotion engine. Promotions are configuration records. Each one defines what it applies to (items, product groups or promotion groups), its tiers and its dates. When a sales order is saved, a User Event totals quantities by item, product group and promotion group, finds every promotion the order qualifies for, and applies the eligible discounts line by line. It also picks the best matching payment terms by a set priority. Around the engine we added:
- a promotion approval form with cost calculations, so a new programme is approved before it goes live;
- copy, delete and item-lookup tools for maintaining promotions;
- a CSV import that creates promotions in bulk;
- a scheduled job that emails each promotion's creator a set number of days before it ends, and deactivates promotions on their end date.
Commissions. A library sets line-level commission on sales orders, standalone invoices, credit memos, cash sales and cash refunds, with separate handling for returns.
Environmental handling fees. On quotes, sales orders and invoices, the fee comes from the ship-to region and each item's fee category. It shows per line and is added as one charge line with the total.
Credit and rebill. A Suitelet guides the correction of an invoice. A rebill starts a new sales order copied from the original invoice. A credit transforms the invoice into a credit memo. The process ends when the return is received and the credit applied to the original invoice, and the new order is fulfilled and invoiced. A companion job closes return authorization lines that were not fully received, so open returns do not linger.
What it does now
Orders carry the right discounts and terms as soon as they are saved, and promotions expire on their end date. Commissions and fees are calculated the same way on every document.
Under the hood
- Promotion rules are data in custom records, so a new programme needs no script change.
- Qualification uses quantities summed across the whole order, which tiered and group deals require.
- Terms selection follows a fixed priority order, so the outcome is predictable.
- Bulk CSV import and scheduled expiry take maintenance work off sales operations.
- Credit and rebill is a sequence of standard transformations, so the audit trail uses NetSuite's own links.