Skip to main content

Deploy to Production

Production deployments require careful planning, testing, and approval processes to ensure business continuity.


Production Deployment Process

┌─────────────────────────────────────────────────────────────────────────────┐
│ PRODUCTION DEPLOYMENT WORKFLOW │
└─────────────────────────────────────────────────────────────────────────────┘

┌──────────────────┐
│ Sandbox Tested │
└────────┬─────────┘


┌──────────────────────────────────────────────────────────────────┐
│ 1. PRE-PRODUCTION REVIEW │
│ ────────────────────────────────────────────────────────────────│
│ • Code review completed │
│ • All tests passed in sandbox │
│ • Business sign-off obtained │
│ • Deployment window scheduled │
└──────────────────────────────┬───────────────────────────────────┘


┌──────────────────────────────────────────────────────────────────┐
│ 2. PRODUCTION PREPARATION │
│ ────────────────────────────────────────────────────────────────│
│ • Export current configuration (backup) │
│ • Document rollback procedure │
│ • Notify stakeholders │
│ • Verify deployment account access │
└──────────────────────────────┬───────────────────────────────────┘


┌──────────────────────────────────────────────────────────────────┐
│ 3. DEPLOY │
│ ────────────────────────────────────────────────────────────────│
│ • Deploy during low-traffic window │
│ • Monitor deployment progress │
│ • Verify no errors │
└──────────────────────────────┬───────────────────────────────────┘


┌──────────────────────────────────────────────────────────────────┐
│ 4. POST-DEPLOYMENT VERIFICATION │
│ ────────────────────────────────────────────────────────────────│
│ • Test critical functionality │
│ • Monitor execution logs │
│ • Verify integrations working │
│ • Confirm with stakeholders │
└──────────────────────────────────────────────────────────────────┘

Pre-Production Checklist

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

CODE QUALITY
☐ Code review completed by senior developer
☐ No console.log or debug code in production
☐ Proper error handling in place
☐ Log levels appropriate (audit, not debug)

TESTING
☐ All unit tests passing
☐ Integration tests completed in sandbox
☐ User acceptance testing signed off
☐ Edge cases tested

DOCUMENTATION
☐ Deployment guide updated
☐ Rollback procedure documented
☐ User documentation ready
☐ Change log updated

APPROVALS
☐ Business owner approval
☐ IT manager approval
☐ Deployment window approved
☐ Stakeholders notified

TECHNICAL
☐ Production account configured in SDF
☐ All dependencies verified
☐ No hardcoded sandbox IDs
☐ Feature flags set correctly

Configure Production Account

Add Production Account

# Setup production account
suitecloud account:setup

# Select: Add a new account
# Choose: Production account
# Enter account ID (e.g., 1234567)
# Complete OAuth flow

List Accounts

suitecloud account:list

Output:

Available accounts:
1. Sandbox (TSTDRV1234567) [default]
2. Production (1234567)

Set Account for Deployment

# Set production as target
suitecloud account:setdefault --account "Production"

# Or specify during deploy
suitecloud project:deploy --account "Production"

Backup Before Deployment

Export Current Objects

# Import current production objects for backup
suitecloud project:import --objects "customscript_*"

# Save to backup folder
mkdir backup_$(date +%Y%m%d)
cp -r Objects/* backup_$(date +%Y%m%d)/

Document Current State

/**
* Pre-deployment state documentation
* Date: 2024-01-15
*
* Scripts to be updated:
* - customscript_invoice_validation_ue (v1.2 → v1.3)
* - customscript_order_confirmation_sl (v2.0 → v2.1)
*
* New deployments:
* - customscript_inventory_alert_ss
*
* Custom records:
* - customrecord_approval_config (adding 2 new fields)
*/

Deployment Strategies

Strategy 1: Full Deployment

Deploy entire project at once:

suitecloud project:deploy --account "Production"

Use when:

  • Initial deployment
  • Major version release
  • All changes are interdependent

Strategy 2: Incremental Deployment

Deploy specific objects:

# Deploy only scripts
suitecloud object:deploy --scriptid "customscript_invoice_ue" --account "Production"

# Deploy multiple specific objects
suitecloud object:deploy --scriptid "customscript_order_sl,customscript_customer_cs" --account "Production"

Use when:

  • Small updates
  • Bug fixes
  • Adding new independent features

Strategy 3: Phased Deployment

┌─────────────────────────────────────────────────────────────────────────────┐
│ PHASED DEPLOYMENT │
└─────────────────────────────────────────────────────────────────────────────┘

PHASE 1: Infrastructure
├── Custom lists
├── Custom records
└── Custom fields


PHASE 2: Core Logic
├── Library scripts
├── Scheduled scripts
└── RESTlets


PHASE 3: UI Components
├── User Event scripts
├── Client scripts
└── Suitelets


PHASE 4: Workflows
└── Workflow definitions

Deployment Script Status

Initial Deployment Settings

For new scripts, deploy with Testing status first:

<scriptdeployment scriptid="customdeploy_invoice_ue">
<status>TESTING</status> <!-- Only you can trigger -->
<loglevel>DEBUG</loglevel>
<!-- ... -->
</scriptdeployment>

Promote to Released

After verification:

<scriptdeployment scriptid="customdeploy_invoice_ue">
<status>RELEASED</status> <!-- Active for all users -->
<loglevel>AUDIT</loglevel>
<!-- ... -->
</scriptdeployment>

Or update in NetSuite UI:

Customization → Scripting → Script Deployments → [Find Script] → Edit → Status: Released

Deployment During Business Hours

Minimize Impact

/**
* Add feature flag for gradual rollout
*/
const isFeatureEnabled = () => {
const script = runtime.getCurrentScript();
return script.getParameter({ name: 'custscript_enable_new_feature' }) === true;
};

const beforeSubmit = (context) => {
if (!isFeatureEnabled()) {
// Use old logic
return oldValidation(context);
}

// Use new logic
return newValidation(context);
};

Deployment Timing

Time WindowRisk LevelRecommended For
After hoursLowMajor changes, new features
Early morningMediumUpdates, bug fixes
During dayHighCritical hotfixes only
Month-endAvoidNever deploy during close

Post-Deployment Verification

Verification Checklist

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

IMMEDIATE (Within 15 minutes)
☐ All scripts deployed successfully
☐ No errors in deployment log
☐ Scripts showing in NetSuite
☐ Correct status (Testing/Released)

SHORT-TERM (Within 1 hour)
☐ Test critical transaction flows
☐ Check execution logs for errors
☐ Verify integrations responding
☐ Spot check data accuracy

MONITORING (24-48 hours)
☐ Monitor execution log volume
☐ Check for governance issues
☐ Review user feedback
☐ Verify scheduled scripts running

Quick Verification Script

/**
* @NApiVersion 2.1
* @NScriptType Suitelet
* @description Deployment verification suitelet
*/
define(['N/search', 'N/runtime', 'N/log'], (search, runtime, log) => {

const onRequest = (context) => {
const checks = [];

// Check script deployments
const scripts = ['customscript_invoice_ue', 'customscript_order_sl'];

scripts.forEach(scriptId => {
const deploySearch = search.create({
type: 'scriptdeployment',
filters: [
['script.scriptid', 'is', scriptId]
],
columns: ['status', 'loglevel']
});

deploySearch.run().each((result) => {
checks.push({
script: scriptId,
status: result.getValue('status'),
logLevel: result.getValue('loglevel'),
ok: result.getValue('status') === 'RELEASED'
});
return true;
});
});

// Return results
context.response.write(JSON.stringify(checks, null, 2));
};

return { onRequest };
});

Production Monitoring

Execution Logs

Monitor scripts after deployment:

Customization → Scripting → Script Execution Logs

Filter by:

  • Date: Today
  • Script: Your deployed scripts
  • Level: Error (to catch issues quickly)

Governance Monitoring

// Add governance logging to production scripts
const logGovernance = (stage) => {
const remaining = runtime.getCurrentScript().getRemainingUsage();
log.audit('Governance', `${stage}: ${remaining} units remaining`);
};

Alert Setup

Create saved search for script errors:

const errorAlertSearch = search.create({
type: 'scriptexecutionlog',
filters: [
['date', 'onorafter', 'today'],
'AND',
['type', 'is', 'ERROR']
],
columns: ['script', 'detail', 'date']
});

Deployment Documentation

Change Log Template

# Deployment: 2024-01-15

## Version: 1.3.0

## Changes
- Updated invoice validation logic (JIRA-123)
- Added new approval workflow (JIRA-456)
- Fixed customer portal timeout (JIRA-789)

## Scripts Deployed
| Script ID | Type | Action | Version |
|-----------|------|--------|---------|
| customscript_invoice_ue | User Event | Updated | 1.2→1.3 |
| customscript_approval_wf | Workflow | New | 1.0 |
| customscript_portal_rl | RESTlet | Updated | 2.0→2.1 |

## Deployment Details
- Deployed by: John Smith
- Start time: 2024-01-15 18:00 PST
- End time: 2024-01-15 18:15 PST
- Status: Success

## Verification
- [x] All scripts deployed
- [x] Execution logs clean
- [x] Test transactions successful
- [x] Stakeholder sign-off

## Rollback Plan
If issues occur, run: `suitecloud project:deploy --project backup_20240115`

Common Production Issues

IssueCauseSolution
Script not triggeringDeployment status is TestingChange to Released
Permission errorsRole not in audienceUpdate deployment audience
Different behavior than sandboxEnvironment-specific dataCheck for hardcoded IDs
Performance issuesHigher data volumeReview governance, add pagination
Missing dependenciesObject deployment orderDeploy dependencies first

Emergency Procedures

Immediate Rollback Triggers

  • Critical business process broken
  • Data corruption occurring
  • Integration failures
  • User complaints widespread

Emergency Contacts

Document before deployment:

Production Issues Contact List:
- Primary: [Name] - [Phone] - [Email]
- Backup: [Name] - [Phone] - [Email]
- NetSuite Admin: [Name] - [Phone] - [Email]
- Business Owner: [Name] - [Phone] - [Email]

Next Steps