This project consists of two main components:
- NowDataGenerator: A ServiceNow script that automates the creation of various types of records with AI-generated content using the NOW Assist Generate Content skill.
- Bulk Data Generator: A high-performance Go utility for generating large quantities of data (10K+ records) for ServiceNow tables.
This script includes a NowDataGenerator class for ServiceNow that automates the creation of various types of records with AI-generated content using the NOW Assist Generate Content skill.
- Incidents
- Changes
- CSM Cases
- HR Cases
- Healthcare Claims
- Knowledge Articles
There is also an additional script include for generating mass summarizies and emailing them.
- All class names have been prefixed with "Now" (e.g., AbstractDataGenerator → NowAbstractDataGenerator)
- Attachment functionality has been removed from all classes
- File names have been updated to match the new class names
- Added ability to split output into separate files for closed and open cases using the
--split=trueparameter - Improved error handling with silent error management for JSON parsing issues
- ServiceNow instance with NOW Assist capabilities
- OpenAI API key
- Access to create and modify Script Includes in ServiceNow
To use the OpenAI API with ServiceNow, you need to set up your API key:
To ensure the NowDataGenerator uses the correct AI provider:
- In the navigation filter, search for the OneExtend Capability table by entering sys_one_extend_capability.list.
- Open the record for the capability that you would like to configure, in this case we want to set a default provider for Generic Prompt.
- In the "OneExtend Definition Configs" related list, set OpenAI as the default provider.
- Save your changes.
- https://docs.servicenow.com/bundle/xanadu-intelligent-experiences/page/administer/generative-ai-controller/task/configure-a-provider-for-a-generative-ai-capability.html
- In your ServiceNow instance, navigate to System Definition > Script Includes.
- Click "New" to create a new Script Include.
- Set the following fields:
- Name: NowAbstractDataGenerator
- API Name: global.NowAbstractDataGenerator
- Client callable: false
- Acceible from: All application scopes
- Active: true
- Copy the entire NowAbstractDataGenerator code into the Script field.
- Click "Submit" to save the Script Include.
- Click "New" to create a new Script Include.
- Set the following fields:
- Name: NowDataGenerator
- API Name: global.NowDataGenerator
- Client callable: false
- Acceible from: All application scopes
- Active: true
- Copy the entire NowDataGenerator code into the Script field.
- Click "Submit" to save the Script Include.
- Click "New" to create a new Script Include.
- Set the following fields:
- Name: NowMassSummarize
- API Name: global.NowMassSummarize
- Client callable: false
- Acceible from: All application scopes
- Active: true
- Copy the entire NowMassSummarize code into the Script field.
- Click "Submit" to save the Script Include.
You can use the NowDataGenerator in various ServiceNow server-side scripts. Here are some examples:
// Instantiate the NowDataGenerator class
var dataGen = new NowDataGenerator();
var incidentSysId = dataGen.createCase('incident', '<Your short description>');
// Log the sys_id of the created incident
gs.info('Created Incident with sys_id: ' + incidentSysId);// Instantiate the NowDataGenerator class
var dataGen = new NowDataGenerator();
// Create a CSM case with a short description
var csmCaseSysId = dataGen.createCase('csm_case', '<Your short description>');
// Log the sys_id of the created CSM case
gs.info('Created CSM Case with sys_id: ' + csmCaseSysId);// Instantiate the NowDataGenerator class
var dataGen = new NowDataGenerator();
// Create an HR case with a short description
var hrCaseSysId = dataGen.createCase('hr_case', '<Your short description>');
// Log the sys_id of the created HR case
gs.info('Created HR Case with sys_id: ' + hrCaseSysId);// Instantiate the NowDataGenerator class
var dataGen = new NowDataGenerator();
var claimSysId = dataGen.createCase('healthcare_claim');
// Log the sys_ids of the created healthcare claims
gs.info('Created Healthcare Claim with sys_id: ' + claimSysId);// Instantiate the NowDataGenerator class
// Create 3 healthcare claims
var healthcareClaimsSysIds = dataGen.createCase('healthcare_claim', null, 3);
// Log the sys_ids of the created healthcare claims
gs.info('Created Healthcare Claims with sys_ids: ' + healthcareClaimsSysIds.join(', '));// Instantiate the NowDataGenerator class
var dataGen = new NowDataGenerator();
// Create a change request (short description is optional, will be generated if not provided)
var changeRequestSysId = dataGen.createCase('change_request');
// Log the sys_id of the created change request
gs.info('Created Change Request with sys_id: ' + changeRequestSysId);
// Alternatively, you can provide a short description if desired
var changeRequestWithDescSysId = dataGen.createCase('change_request', 'Upgrade server firmware');
gs.info('Created Change Request with custom description, sys_id: ' + changeRequestWithDescSysId);
// Create a "bad" change request with problematic plan data that would likely be flagged by an LLM
var badChangeRequestSysId = dataGen.createCase('change_request', 'Server maintenance', { generateBadData: true });
gs.info('Created problematic Change Request with sys_id: ' + badChangeRequestSysId);
// You can also pass options as the third parameter
var anotherBadChangeRequestSysId = dataGen.createCase('change_request', null, { generateBadData: true });
gs.info('Created another problematic Change Request with sys_id: ' + anotherBadChangeRequestSysId);The generateBadData option creates change requests with problematic content in the following fields:
- justification: Vague and incomplete, lacking specific details and business value
- implementation_plan: Missing steps, inconsistent timing, and no clear ownership
- risk_impact_analysis: Downplays risks, ignores service impacts, lacks mitigation strategies
- backout_plan: Inadequate steps, timing issues, doesn't address service restoration
- test_plan: Insufficient test cases, no clear success criteria, missing validation steps
This is useful for testing ServiceNow's ability to detect problematic changes, such as when using an LLM to review change requests.
// Instantiate the NowDataGenerator class
var dataGen = new NowDataGenerator();
// Create a knowledge article with a short description
var knowledgeArticleSysId = dataGen.createCase('knowledge_article', 'How to reset your password');
// Log the sys_id of the created knowledge article
gs.info('Created Knowledge Article with sys_id: ' + knowledgeArticleSysId);// Instantiate the NowDataGenerator class
var dataGen = new NowDataGenerator();
// Create an incident and a related KB article with a short description
var result = dataGen.createIncidentWithKB('Unable to connect to VPN from remote location');
// Log the sys_ids of the created incident and KB article
gs.info('Created Incident with sys_id: ' + result.incident);
gs.info('Created KB Article with sys_id: ' + result.kb_article);
// You can also access the created records directly
var incidentGr = new GlideRecord('incident');
if (incidentGr.get(result.incident)) {
gs.info('Incident short description: ' + incidentGr.short_description);
}
var kbGr = new GlideRecord('kb_knowledge');
if (kbGr.get(result.kb_article)) {
gs.info('KB Article title: ' + kbGr.short_description);
}// Instantiate the NowMassSummarize class
var summarizer = new NowMassSummarize();
// Generate the HTML summary report for the past 30 days
var summaryReport = summarizer.generateSummaryReport(30);
var email = new GlideEmailOutbound();
email.addRecipient('<your@email>');
email.setSubject('Operations Summary');
email.setBody(summaryReport);
email.save();You can customize the NowDataGenerator by modifying the following:
- Update the
sys_idconstants at the top of the script to match your ServiceNow instance's record system IDs. - Modify the
_createIncident,_createCSMCase, and_createHRCasemethods to include additional fields or logic specific to your needs. - Adjust the prompt templates in the
_generateEntriesmethod to generate different types of content.
A high-performance Go utility for generating large quantities of data (10K+ records) for ServiceNow tables with LLM-powered descriptions and cross-platform support.
- High Performance: Concurrent processing with configurable batch sizes
- Multiple Output Formats: Excel (.xlsx) and CSV support
- LLM Integration: OpenRouter API integration for realistic descriptions
- Cross-Platform: Builds for Windows, macOS, and Linux
- ServiceNow Compatible: Generates data in ServiceNow import format
- Split Output: Option to separate closed and open records
- Fallback Mode: Works without API key using realistic fallback data
- Comprehensive Test Suite: 29 test functions with 100% coverage
- Incident (
incident): IT Service Management incidents with realistic technical issues - Case (
case): Customer Service Management cases with account relationships - HR Case (
hr_case): Human Resources cases for employee services - Change Request (
change_request): Change management with comprehensive planning - Knowledge Article (
knowledge_article): Knowledge base articles with structured content
Download the latest release from the GitHub Releases page:
- Windows (64-bit):
bulk-generator-windows-amd64.exe - macOS (Intel):
bulk-generator-darwin-amd64 - macOS (Apple Silicon):
bulk-generator-darwin-arm64 - Linux (64-bit):
bulk-generator-linux-amd64
No installation required - just download and run! The binaries are statically compiled and include all dependencies.
# Windows
.\bulk-generator-windows-amd64.exe --help
# macOS/Linux (make executable first)
chmod +x bulk-generator-darwin-amd64 # or your platform's binary
./bulk-generator-darwin-amd64 --helpRequirements:
- Go 1.21 or later
# Clone the repository
git clone https://github.com/michaelbuckner/NOW-Dynamic-Data-Generator.git
cd NOW-Dynamic-Data-Generator
# Install dependencies
go mod download
# Build for current platform
go build -o bulk-generator ./cmd
# Or use the build scripts for cross-platform builds
chmod +x build.sh
./build.sh# Generate 1000 incident records
./bulk-generator --table incident --count 1000 --output incidents.xlsx
# Generate 500 case records
./bulk-generator --table case --count 500 --output cases.xlsx
# Generate HR cases
./bulk-generator --table hr_case --count 100 --output hr-cases.xlsx
# Generate change requests
./bulk-generator --table change_request --count 50 --output changes.xlsx
# Generate knowledge articles
./bulk-generator --table knowledge_article --count 25 --output kb-articles.xlsx
# Generate CSV output
./bulk-generator --table incident --count 100 --output incidents.csv# Use OpenRouter API for realistic descriptions
export OPENROUTER_API_KEY="your-api-key-here"
./bulk-generator --table incident --count 1000 --model "google/gemini-2.0-flash-001"
# Split output into separate files for closed and open records
./bulk-generator --table case --count 1000 --split --closed 40 --output cases.xlsx
# Creates: cases-closed.xlsx and cases-open.xlsx
# Custom batch size for memory management
./bulk-generator --table incident --count 10000 --batch 500 --output large-dataset.xlsx
# Pass API key directly
./bulk-generator --table case --count 100 --api-key "your-key" --output cases.xlsx| Flag | Short | Default | Description |
|---|---|---|---|
--output |
-o |
bulk-data.xlsx |
Output file name |
--count |
-c |
10000 |
Number of records to generate |
--batch |
-b |
1000 |
Batch size for processing |
--table |
-t |
incident |
Table name (incident, case, hr_case, change_request, knowledge_article) |
--closed |
30 |
Percentage of closed records (0-100) | |
--split |
false |
Split output into separate files | |
--model |
-m |
google/gemini-2.0-flash-001 |
LLM model to use |
--api-key |
-k |
OpenRouter API key |
OPENROUTER_API_KEY: Your OpenRouter API key for LLM integration
The generator provides excellent performance through concurrent processing:
- Concurrent Processing: Generates multiple records simultaneously
- Memory Efficient: Processes data in configurable batches
- Fast I/O: Optimized Excel and CSV writing
- Low Resource Usage: Minimal memory footprint
Typical performance on modern hardware:
| Records | Format | Time | Memory |
|---|---|---|---|
| 1,000 | Excel | ~30s | ~50MB |
| 10,000 | Excel | ~4min | ~200MB |
| 100,000 | CSV | ~15min | ~500MB |
Performance varies based on LLM API response times and system specifications.
- Professional formatting with headers
- Optimized for ServiceNow import
- Supports large datasets (1M+ rows)
- Standard comma-separated values
- UTF-8 encoding
- Compatible with Excel and other tools
The generator uses OpenRouter API to create realistic:
- Short descriptions
- Detailed descriptions
- Close notes and resolution details
- Change request planning (justification, implementation, risk analysis, backout plans, test plans)
- Knowledge article content with structured HTML
google/gemini-2.0-flash-001(default)anthropic/claude-3-haikuopenai/gpt-4o-mini- Any OpenRouter-compatible model
When no API key is provided, the generator uses:
- Realistic fallback descriptions
- Category-specific templates
- Randomized but logical data
Generated records include:
- Realistic technical issues and resolutions
- Proper impact/urgency/priority relationships
- ServiceNow workflow states
- Assignment groups and technicians
- Customer account relationships
- Contact information and communication preferences
- Service organization assignments
- Escalation and resolution tracking
- Employee relations scenarios
- Benefits and payroll issues
- Compliance and training requests
- Due date calculations
- Comprehensive change planning with 5 LLM-generated sections:
- Justification: Business case for the change
- Implementation Plan: Step-by-step execution details
- Risk Analysis: Potential risks and mitigation strategies
- Backout Plan: Rollback procedures if needed
- Test Plan: Validation and testing approach
- Risk assessments and approval workflows
- Configuration item relationships
- Structured HTML content with headings and lists
- Technical procedures and troubleshooting guides
- Keywords and metadata
- Publication workflows and author attribution
The src/servicenow/ directory contains server-side JavaScript utilities for ServiceNow:
- ExportTableFieldInfo.js: Export field information from ServiceNow tables
- NowAbstractDataGenerator.js: Abstract base class for data generation
- NowDataGenerator.js: Core data generation utilities
- NowFieldInfoGatherer.js: Gather field metadata and choice lists
- NowMassSummarize.js: Mass operations for data summarization
These scripts are designed to be run within ServiceNow as server-side JavaScript. They provide utilities for:
- Analyzing table structures and field definitions
- Gathering choice list values and reference data
- Performing mass data operations
- Generating realistic test data within ServiceNow
The project includes a comprehensive test suite with 29 test functions:
# Run all tests
go test ./...
# Run tests with verbose output
go test ./... -v
# Run full test suite with benchmarks and coverage
./run_tests.shSee TEST_SUITE.md for detailed testing documentation.
- API Rate Limits: Reduce batch size with
--batch 100 - Memory Issues: Use smaller batches or CSV output
- Permission Errors: Ensure write access to output directory
- Large Files: Excel has ~1M row limit, use CSV for larger datasets
# Enable verbose output
./bulk-generator --table incident --count 100 -v
# Check API connectivity
./bulk-generator --table incident --count 1 --api-key "test-key"This project uses GitHub Actions to automatically build cross-platform binaries and create releases. To create a new release:
# Make sure you're on the main branch with latest changes
git checkout main
git pull origin main
# Create and push a new release tag
./create-release.sh v1.0.0The script will:
- Validate the version tag format (vX.Y.Z)
- Check for uncommitted changes
- Run the test suite
- Create and push the git tag
- Trigger the GitHub Actions workflow
# Create a tag
git tag -a v1.0.0 -m "Release v1.0.0"
# Push the tag
git push origin v1.0.0The GitHub Actions workflow will automatically:
- Build binaries for all four platforms (Windows, macOS Intel, macOS ARM, Linux)
- Run tests to ensure quality
- Create a GitHub release with auto-generated release notes
- Attach all binaries to the release
Monitor the build progress at: https://github.com/michaelbuckner/NOW-Dynamic-Data-Generator/actions
- Attachment functionality has been removed from all classes. If you need to add attachments to records, you will need to implement this functionality separately.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Run the test suite:
./run_tests.sh - Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
For issues and questions:
- Check the troubleshooting section
- Review the test suite documentation
- Search existing GitHub issues
- Create a new issue with detailed information
Built with ❤️ for the ServiceNow community

