SuiteQL Query Library

Sales Order: With Sales Tax

Returns header-level values for a specified Sales Order, including the Tax Total value sourced from the related TransactionLine records.

-- Contributor: Tim Dietrich (timdietrich@me.com)
-- Additional Info: https://timdietrich.me/blog/netsuite-suiteql-sales-tax/
SELECT
	Transaction.TranID,
	Transaction.TranDate,
	Transaction.Entity AS CustomerID,
	BUILTIN.DF( Transaction.Entity ) AS CustomerName,
	BUILTIN.DF( Transaction.Status ) AS Status,
	Transaction.ForeignTotal AS Total,
	( 
		SELECT 
			SUM( TransactionLine.ForeignAmount * -1 ) AS SalesTax 
		FROM
			TransactionLine 
		WHERE
			( TransactionLine.Transaction = Transaction.ID )
			AND ( TransactionLine.TaxLine = 'T' )
	) AS SalesTax
FROM 
	Transaction
WHERE 
	( Transaction.Type = 'SalesOrd' )
	AND ( Transaction.ID = 11708 )

Click here to return to the list of available queries.

About Me

Hello, I’m Tim Dietrich. I design and build custom software for businesses running on NetSuite — from mobile apps and Web portals to Web APIs and integrations.

I’ve created several widely used open-source solutions for the NetSuite community, including the SuiteQL Query Tool and SuiteAPI, which help developers and businesses get more out of their systems.

I’m also the founder of SuiteStep, a NetSuite development studio focused on pushing the boundaries of what’s possible on the platform. Through SuiteStep, I deliver custom software and AI-driven solutions that make NetSuite more powerful, accessible, and future-ready.

Copyright © 2025 Tim Dietrich.