Enhanced SuiteQL Query Tool
A utility for running SuiteQL queries in a NetSuite instance with modern IDE-like features including syntax highlighting, auto-formatting, and optimized large data display.
Download
| Version | Description | Download |
|---|---|---|
| CDN | Libraries loaded from CDN (requires internet) | Download CDN Version |
| Local | All libraries included locally (offline capable) | Download Local Version (.zip) |
Download Info
- CDN Version: Downloads a single Suitelet file (
.js). Libraries are loaded from CDN at runtime. - Local Version: Downloads a
.zipfile containing the Suitelet file andlib/folder with all required libraries.
Features
SQL Editor (CodeMirror)
- Syntax Highlighting - SQL keywords, strings, numbers, comments, and operators are color-coded
- Auto-completion - SQL hints and table/column suggestions as you type
- Line Numbers - Easy reference for query lines
- Active Line Highlighting - Visual indicator for current cursor position
- Bracket Matching - Highlights matching parentheses and brackets
- Close Brackets - Automatically closes parentheses and quotes
Query Formatting
- Auto-format SQL - One-click formatting to beautify your queries
- Keyboard Shortcut - Press
Ctrl+Shift+Fto format SQL instantly
Result Display Options
| Format | Description |
|---|---|
| DataTable | Interactive table with sorting, filtering, and pagination |
| Virtual Scroll | Optimized rendering for large datasets (100+ rows per page) |
| CSV | Export results as comma-separated values |
| JSON | Export results as JSON format |
| Generate PDF documents from query results | |
| HTML | Generate HTML documents from query results |
Theme Support
- Dark/Light Mode Toggle - Switch between dark and light themes
- Professional UI - Clean, modern interface based on SQL IDE best practices
Column Operations
- Column Resizing - Drag column borders to adjust width
- Column Sorting - Click column headers to sort ascending/descending
- Column Filtering - Filter results by specific column values
Query Management
- Save Queries - Save your queries locally for later use
- Load Queries - Load previously saved queries
- Tables Reference - Quick access to available tables and columns
Data Handling
- Pagination - Configurable rows per page (default: 25)
- Large Dataset Support - Virtual scrolling for datasets with thousands of rows
- Copy to Clipboard - One-click copy of CSV/JSON results
Keyboard Shortcuts
| Shortcut | Action |
|---|---|
Ctrl+Shift+F | Format SQL query |
Ctrl+Space | Trigger auto-completion |
Installation
Step 1: Upload Files
For CDN Version:
- Upload
suiteql-query-tool-enhanced-v2.jsto File Cabinet
For Local Version:
- Upload
suiteql-query-tool-enhanced-v2-local.jsto File Cabinet - Upload the entire
lib/folder to File Cabinet (note the folder's Internal ID) - Open the script file and set
libFolderIDto your lib folder's Internal ID (see Configuration below)
Step 2: Create Script Record
- Go to Customization > Scripting > Scripts > New
- Select the uploaded script file
- Set Name:
SuiteQL Query Tool Enhanced - Set ID:
_suiteql_query_tool_enhanced - Save
Step 3: Create Deployment
- Go to the script record's Deployments tab
- Click New Deployment
- Set Status:
Released - Set Audience: Select appropriate roles
- Save and note the External URL
Configuration Options
The script includes several configuration variables at the top:
var datatablesEnabled = true; // Enable DataTables format
var remoteLibraryEnabled = true; // Use CDN for libraries
var rowsReturnedDefault = 25; // Default rows per query
var queryFolderID = null; // File Cabinet folder for saved queries
var toolUpgradesEnabled = true; // Enable tool upgrade checks
var workbooksEnabled = false; // Enable SuiteAnalytics Workbooks
var virtualScrollPageSize = 100; // Rows per virtual scroll page
Local Version Configuration
For the Local Version, you must set the library folder ID:
// Set the internal ID of the folder containing your library files
// Find this ID in File Cabinet by clicking on the lib folder
var libFolderID = 12345; // Replace with your lib folder's Internal ID
How to Find Folder Internal ID
- Go to Documents > Files > File Cabinet
- Navigate to your
libfolder - Click on the folder name
- The Internal ID is shown in the folder details or URL
The script automatically queries the File table to get the correct URLs for all library files in that folder. This ensures the libraries load correctly regardless of where you upload them in the File Cabinet.
Libraries Used
| Library | Version | Purpose |
|---|---|---|
| CodeMirror | 5.65.13 | SQL editor with syntax highlighting |
| Bootstrap | 5.3.0 | UI framework |
| jQuery | 3.5.1 | DOM manipulation (NetSuite built-in) |
| DataTables | 1.x | Interactive table display |
Credits
- Original Author: Tim Dietrich (timdietrich.me)
- Enhanced Version: 2024 Enhancements
Licensed under the MIT License.