Skip to main content

Deploy to Sandbox

This guide walks through deploying your SDF project to a NetSuite sandbox account.


Pre-Deployment Checklist

┌─────────────────────────────────────────────────────────────────────────────┐
│ PRE-DEPLOYMENT CHECKLIST │
└─────────────────────────────────────────────────────────────────────────────┘

☐ Account configured (suitecloud account:setup)
☐ Project validated (suitecloud project:validate)
☐ All files saved and syntax-checked
☐ manifest.xml includes required features
☐ Script deployments configured
☐ Custom objects have correct scriptids
☐ No hardcoded internal IDs
☐ Backup of sandbox taken (if needed)

Deployment Flow

┌─────────────────────────────────────────────────────────────────────────────┐
│ SDF DEPLOYMENT FLOW │
└─────────────────────────────────────────────────────────────────────────────┘

┌──────────────────┐
│ Local Project │
└────────┬─────────┘


┌──────────────────────────────────────────────────────────────────┐
│ 1. VALIDATE │
│ ────────────────────────────────────────────────────────────────│
│ suitecloud project:validate │
│ • Check manifest.xml │
│ • Validate XML syntax │
│ • Check script syntax │
└──────────────────────────────┬───────────────────────────────────┘

┌─────┴─────┐
Errors│ │No Errors
▼ ▼
┌───────────┐ Continue
│Fix Errors │ │
└───────────┘ │

┌──────────────────────────────────────────────────────────────────┐
│ 2. DEPLOY │
│ ────────────────────────────────────────────────────────────────│
│ suitecloud project:deploy │
│ • Upload files to File Cabinet │
│ • Create/update custom objects │
│ • Deploy scripts and deployments │
└──────────────────────────────┬───────────────────────────────────┘


┌──────────────────────────────────────────────────────────────────┐
│ 3. VERIFY │
│ ────────────────────────────────────────────────────────────────│
│ • Check script deployments │
│ • Test functionality │
│ • Review execution logs │
└──────────────────────────────────────────────────────────────────┘

Step 1: Validate Project

Using VSCode

Ctrl+Shift+P → SuiteCloud: Validate Project

Using Terminal

suitecloud project:validate

Expected Output

┌─────────────────────────────────────────────────────────────────────────────┐
│ VALIDATION RESULTS │
└─────────────────────────────────────────────────────────────────────────────┘

Validating project...

✓ manifest.xml is valid
✓ suitecloud.config.js is valid
✓ No syntax errors in scripts
✓ All object references are valid

Validation completed successfully.

Common Validation Errors

ErrorSolution
Invalid manifestCheck XML syntax in manifest.xml
Missing featureAdd required feature to manifest.xml
Script syntax errorCheck JavaScript for errors
Invalid scriptidUse lowercase with underscores
Missing fileEnsure file path in XML is correct

Step 2: Deploy to Sandbox

Using VSCode

Ctrl+Shift+P → SuiteCloud: Deploy to Account
→ Select "Sandbox" account

Using Terminal

# Deploy to default account
suitecloud project:deploy

# Deploy to specific account
suitecloud project:deploy --account "Sandbox"

Deployment Output

┌─────────────────────────────────────────────────────────────────────────────┐
│ DEPLOYMENT PROGRESS │
└─────────────────────────────────────────────────────────────────────────────┘

Starting deployment to account: TSTDRV1234567

Uploading files...
├── SuiteScripts/Suitelets/invoice_report_sl.js ✓
├── SuiteScripts/UserEvents/sales_order_ue.js ✓
└── SuiteScripts/ClientScripts/customer_cs.js ✓

Deploying objects...
├── customlist_approval_status ✓
├── customrecord_approval_request ✓
├── customscript_invoice_report_sl ✓
└── customscript_sales_order_ue ✓

Deployment completed successfully!
Time: 45 seconds

Step 3: Verify Deployment

Check Script Deployments

  1. In NetSuite: Customization → Scripting → Script Deployments
  2. Find your deployed scripts
  3. Verify status is "Released" or "Testing"
  4. Check record types and audience

Test Functionality

  1. Navigate to your Suitelet URL
  2. Trigger User Event scripts
  3. Check Client Script behavior
  4. Verify workflow actions

Check Execution Logs

  1. Customization → Scripting → Script Execution Logs
  2. Filter by script
  3. Check for errors or debug messages

Troubleshooting Deployment

"Authentication Failed"

# Re-setup account
suitecloud account:setup

# List configured accounts
suitecloud account:list

# Set default account
suitecloud account:setdefault --account "Sandbox"

"Object Already Exists"

The object exists with same scriptid. Options:

  1. Update existing: Deploy will update the object
  2. Different scriptid: Change scriptid in your project
  3. Remove first: Delete object in NetSuite before deploy

"Missing Dependency"

Object references something that doesn't exist:

<!-- Ensure referenced objects deploy first -->
<selectrecordtype>[customlist_approval_status]</selectrecordtype>

<!-- Make sure customlist_approval_status is in your project -->

"Script Error on Deployment"

Check script syntax:

# Validate just the script
node --check src/FileCabinet/SuiteScripts/Suitelets/my_script.js

Deploy Specific Objects

Deploy only certain objects:

# Deploy specific object types
suitecloud object:deploy --type customscript

# Deploy specific objects
suitecloud object:deploy --scriptid customscript_invoice_sl

# Deploy from deploy.xml
suitecloud project:deploy --dryrun # Preview first

deploy.xml Configuration

Control what gets deployed:

<?xml version="1.0" encoding="UTF-8"?>
<deploy>
<configuration>
<path>~/Objects/*</path>
</configuration>
<files>
<path>~/FileCabinet/SuiteScripts/**</path>
</files>
<objects>
<!-- Only deploy these objects -->
<path>~/Objects/customscript_*.xml</path>
<path>~/Objects/customlist_*.xml</path>
</objects>
</deploy>

Post-Deployment Steps

┌─────────────────────────────────────────────────────────────────────────────┐
│ POST-DEPLOYMENT CHECKLIST │
└─────────────────────────────────────────────────────────────────────────────┘

☐ Verify all scripts are deployed
☐ Test each script function
☐ Check execution logs for errors
☐ Verify custom records created
☐ Test workflows are active
☐ Configure script parameters
☐ Set up scheduled script schedules
☐ Update role permissions if needed
☐ Document deployment version

Setting Up Testing Environment

Enable Debug Logging

In script deployment:

  • Set Log Level: DEBUG
  • This captures all log.debug() calls

Test Data

Create test records:

  • Use specific naming: "TEST - Customer Name"
  • Use test transactions with recognizable amounts

Monitor Logs

// Add detailed logging during testing
log.debug('Function Entry', 'Starting process');
log.debug('Parameters', JSON.stringify(context.request.parameters));
log.debug('Record Data', JSON.stringify({
id: record.id,
type: record.type
}));

Next Steps