A collection of reusable SuiteScript 2.1 helper functions and modules for common NetSuite development tasks. These utilities are designed to improve code quality, reduce development time, and enforce best practices.
FlowSync Consulting specializes in NetSuite customization, integration, and automation. These utilities reflect the code quality and architectural patterns we use in client projects.
Contact us for NetSuite consulting services →
- Date Handling - Timezone-aware date manipulation and formatting
- Search Wrappers - Simplified saved search API with pagination support
- Error Logging - Centralized error handling and logging framework
- Record Utilities - Common record operations (load, save, delete) with error handling
- Field Validation - Reusable validation functions for common field types
- Governance Monitoring - Track governance usage and prevent limit violations
- API Helpers - HTTP request helpers with retry logic and rate limiting
src/
├── date/
│ ├── format.js # Date formatting utilities
│ ├── timezone.js # Timezone conversion helpers
│ └── business-days.js # Business day calculations
├── search/
│ ├── wrapper.js # Simplified search API
│ ├── pagination.js # Automatic result pagination
│ └── filters.js # Filter builder utilities
├── logging/
│ ├── logger.js # Centralized logging framework
│ ├── error-handler.js # Error handling utilities
│ └── governance.js # Governance monitoring
├── record/
│ ├── operations.js # Safe record operations
│ ├── validation.js # Field validation utilities
│ └── lookups.js # Field lookup helpers
└── http/
├── request.js # HTTP request wrapper
├── retry.js # Retry logic for API calls
└── rate-limit.js # Rate limiting utilities
- Download the utility modules you need
- Upload to FileCabinet:
/SuiteScripts/lib/ - Reference in your scripts:
/**
* @NApiVersion 2.1
* @NScriptType UserEventScript
*/
define(['./lib/logger', './lib/record/operations'],
(logger, recordOps) => {
// Your script logic
});define(['./lib/date/format'], (dateFormat) => {
const formatted = dateFormat.toISO(new Date());
// Returns: "2026-03-20T10:30:00Z"
const userFriendly = dateFormat.toDisplay(new Date());
// Returns: "3/20/2026"
});define(['./lib/search/wrapper'], (searchWrapper) => {
const results = searchWrapper.runPaginated({
type: 'customer',
filters: [['stage', 'is', 'CUSTOMER']],
columns: ['entityid', 'email']
});
results.forEach(customer => {
log.audit('Customer', customer.getValue('entityid'));
});
});define(['./lib/logging/logger', './lib/logging/error-handler'],
(logger, errorHandler) => {
try {
// Your logic here
} catch (e) {
errorHandler.log({
error: e,
context: 'afterSubmit',
recordType: context.newRecord.type,
recordId: context.newRecord.id
});
}
});define(['./lib/logging/governance'], (governance) => {
governance.checkUsage(); // Logs current usage
if (governance.isNearLimit()) {
log.audit('Warning', 'Approaching governance limits');
}
});All utilities include:
- Comprehensive JSDoc comments
- Error handling with detailed logging
- Governance limit awareness
- Unit test examples (coming soon)
- Inline usage documentation
These utilities are written for SuiteScript 2.1 (the current standard). For SuiteScript 1.0 compatibility, see the legacy branch.
Found a bug or have a utility to contribute? Open an issue or submit a pull request. All contributions should:
- Include JSDoc comments
- Follow the existing code style
- Include usage examples
- Handle errors gracefully
MIT License - see LICENSE file for details.
- Website: FlowSync Consulting
- Email: contact@flowsync-preview.internal
- GitHub: @FlowSync-Consulting
Status: 🚧 Work in progress - utilities being added incrementally
Roadmap:
- Date/time utilities (in progress)
- Search wrappers (in progress)
- Logging framework (planned)
- Record operations (planned)
- HTTP helpers (planned)
- Unit testing examples (planned)