Skip to main content

Git Workflows

Step-by-step workflows for common development scenarios using SuiteCloud Development Framework (SDF) in VSCode.


Branch Strategy Overview

main ─────────────────────────────────────────────────────► Production
│ ▲
│ │ (hotfix merge)
│ hotfix/critical-fix ────────────────────────────────────┤
│ │
▼ │
develop ──────────────────────────────────────────────────────► Integration
│ ▲ ▲
│ │ │
│ feature/NS-123-new-feature ──────────┘ │
│ │
│ bugfix/NS-456-fix-issue ────────────────────────┘

Branch Types Summary

Branch TypeSourceTargetPurpose
feature/developdevelopNew functionality
bugfix/developdevelopNon-critical fixes
hotfix/mainmain → developCritical production fixes
New to the Team?

If you're a new employee, start with the New Employee Onboarding guide to set up your development environment first.


Feature Development Workflow

When to Use

  • Adding new SuiteScript (Suitelet, RESTlet, Map/Reduce, etc.)
  • Creating new custom records or fields
  • Implementing workflow enhancements
  • Building new reports or saved searches
  • Any non-urgent development work

Flow Diagram

┌─────────────────────────────────────────────────────────────────────────────────┐
│ FEATURE DEVELOPMENT WORKFLOW │
└─────────────────────────────────────────────────────────────────────────────────┘

┌──────────────┐
│ START │
└──────┬───────┘


┌─────────────────────────┐
│ 1. Sync develop branch │
│ ───────────────────────│
│ git checkout develop │
│ git pull origin develop│
└───────────┬─────────────┘


┌─────────────────────────────────────┐
│ 2. Create feature branch │
│ ───────────────────────────────────│
│ git checkout -b feature/NS-XXX-name│
└───────────┬─────────────────────────┘


┌─────────────────────────────────────┐
│ 3. Open SDF Project in VSCode │
│ ───────────────────────────────────│
│ • Open project folder │
│ • Verify suitecloud.config.js │
│ • Check account authentication │
└───────────┬─────────────────────────┘


┌─────────────────────────────────────┐
│ 4. Develop in VSCode │◄──────────────┐
│ ───────────────────────────────────│ │
│ • Create/modify scripts │ │
│ • Update objects (XML) │ │
│ • Test with SDF Validate │ │
└───────────┬─────────────────────────┘ │
│ │
▼ │
┌─────────────────────────────────────┐ │
│ 5. Commit changes │ │
│ ───────────────────────────────────│ │
│ git add . │ │
│ git commit -m "[NS-XXX] message" │ │
└───────────┬─────────────────────────┘ │
│ │
▼ │
┌──────────────┐ Yes │
│ More changes?├─────────────────────────────────┘
└──────┬───────┘
│ No

┌─────────────────────────────────────┐
│ 6. Deploy to Sandbox (Optional) │
│ ───────────────────────────────────│
│ SDF: Deploy to Account (Sandbox) │
│ • Validate deployment │
│ • Test functionality │
└───────────┬─────────────────────────┘


┌─────────────────────────────────────┐
│ 7. Push to GitHub │
│ ───────────────────────────────────│
│ git push -u origin feature/NS-XXX │
└───────────┬─────────────────────────┘


┌─────────────────────────────────────┐
│ 8. Create Pull Request │
│ ───────────────────────────────────│
│ • Go to GitHub repository │
│ • Click "New Pull Request" │
│ • Base: develop ← Compare: feature │
│ • Add description & reviewers │
└───────────┬─────────────────────────┘


┌─────────────────────────────────────┐
│ 9. Code Review │
│ ───────────────────────────────────│
│ • Team reviews changes │
│ • Address feedback if any │
│ • Get approval │
└───────────┬─────────────────────────┘


┌──────────────┐ No ┌─────────────────┐
│ Approved? ├──────────►│ Address feedback│
└──────┬───────┘ └────────┬────────┘
│ Yes │
│ │
│ ◄───────────────────────┘

┌─────────────────────────────────────┐
│ 10. Merge to develop │
│ ───────────────────────────────────│
│ • Squash and merge (recommended) │
│ • Delete feature branch │
└───────────┬─────────────────────────┘


┌─────────────────────────────────────┐
│ 11. Local cleanup │
│ ───────────────────────────────────│
│ git checkout develop │
│ git pull origin develop │
│ git branch -d feature/NS-XXX │
└───────────┬─────────────────────────┘


┌──────────────┐
│ END │
└──────────────┘

Detailed Steps with SDF Commands

Step 1-2: Setup Branch

# Switch to develop and get latest
git checkout develop
git pull origin develop

# Create feature branch
git checkout -b feature/vendor-NS123-new-suitelet

Step 3: VSCode SDF Setup

  1. Open your SDF project folder in VSCode
  2. Verify authentication:
    • Press Ctrl+Shift+P → Type "SuiteCloud: Set Up Account"
    • Or check terminal: suitecloud account:setup
  3. Verify project configuration:
    📁 YourProject/
    ├── 📄 suitecloud.config.js ← Project config
    ├── 📁 src/
    │ ├── 📁 FileCabinet/
    │ │ └── 📁 SuiteScripts/ ← Your scripts here
    │ └── 📁 Objects/ ← Custom objects (XML)
    └── 📄 manifest.xml ← Deployment manifest

Step 4: Development in VSCode

Creating a new Suitelet:

Ctrl+Shift+P → SuiteCloud: Create SuiteScript
→ Select "Suitelet"
→ Enter filename
→ Script created in FileCabinet/SuiteScripts/

Validating your changes:

Ctrl+Shift+P → SuiteCloud: Validate Project

Common file locations:

TypeLocation
SuiteScriptssrc/FileCabinet/SuiteScripts/
Custom Recordssrc/Objects/customrecord_*.xml
Custom Fieldssrc/Objects/customfield_*.xml
Workflowssrc/Objects/workflow_*.xml
Saved Searchessrc/Objects/savedsearch_*.xml

Step 5: Commit Changes

# Stage all changes
git add .

# Commit with ticket reference
git commit -m "[NS-123] Add vendor invoice automation suitelet

- Created vendor_invoice_suitelet.js
- Added custom record for tracking
- Configured deployment"

Step 6: Deploy to Sandbox (Testing)

Ctrl+Shift+P → SuiteCloud: Deploy to Account
→ Select your Sandbox account
→ Wait for deployment to complete

Or via terminal:

suitecloud project:deploy --account SANDBOX_ACCOUNT_ID

Step 7-8: Push and Create PR

# Push branch to GitHub
git push -u origin feature/vendor-NS123-new-suitelet

Then on GitHub:

  1. Navigate to your repository
  2. Click "Compare & pull request"
  3. Set base: developcompare: feature/vendor-NS123-new-suitelet
  4. Fill in the PR template
  5. Assign reviewers

Step 9-11: Review, Merge, Cleanup

After approval:

# After PR is merged on GitHub
git checkout develop
git pull origin develop

# Delete local feature branch
git branch -d feature/vendor-NS123-new-suitelet

Bug Fix Workflow

When to Use

  • Fixing non-critical bugs found in develop
  • Issues that can wait for next release cycle
  • Problems discovered during testing
  • Minor corrections to existing functionality

Flow Diagram

┌─────────────────────────────────────────────────────────────────────────────────┐
│ BUGFIX WORKFLOW │
└─────────────────────────────────────────────────────────────────────────────────┘

┌──────────────┐
│ START │
│ (Bug found) │
└──────┬───────┘


┌─────────────────────────────────────┐
│ 1. Reproduce & Document Bug │
│ ───────────────────────────────────│
│ • Identify affected script/object │
│ • Note error messages │
│ • Document reproduction steps │
└───────────┬─────────────────────────┘


┌─────────────────────────────────────┐
│ 2. Sync develop branch │
│ ───────────────────────────────────│
│ git checkout develop │
│ git pull origin develop │
└───────────┬─────────────────────────┘


┌─────────────────────────────────────────────┐
│ 3. Create bugfix branch │
│ ───────────────────────────────────────────│
│ git checkout -b bugfix/NS-XXX-description │
└───────────┬─────────────────────────────────┘


┌─────────────────────────────────────┐
│ 4. Locate issue in VSCode │
│ ───────────────────────────────────│
│ • Use Search (Ctrl+Shift+F) │
│ • Check Execution Log in NetSuite │
│ • Review SuiteScript Debugger │
└───────────┬─────────────────────────┘


┌─────────────────────────────────────┐
│ 5. Implement fix │
│ ───────────────────────────────────│
│ • Make minimal necessary changes │
│ • Add error handling if needed │
│ • Validate with SDF │
└───────────┬─────────────────────────┘


┌─────────────────────────────────────┐
│ 6. Test fix in Sandbox │
│ ───────────────────────────────────│
│ • Deploy to Sandbox account │
│ • Reproduce original bug scenario │
│ • Verify fix works │
│ • Check no regression │
└───────────┬─────────────────────────┘


┌──────────────┐ No ┌─────────────────┐
│ Fix works? ├──────────►│ Debug further │
└──────┬───────┘ └────────┬────────┘
│ Yes │
│ ◄───────────────────────┘

┌─────────────────────────────────────┐
│ 7. Commit changes │
│ ───────────────────────────────────│
│ git add . │
│ git commit -m "[NS-XXX] Fix: desc" │
└───────────┬─────────────────────────┘


┌─────────────────────────────────────┐
│ 8. Push and create PR │
│ ───────────────────────────────────│
│ git push -u origin bugfix/NS-XXX │
│ • Create PR to develop │
│ • Reference bug ticket │
│ • Describe root cause & fix │
└───────────┬─────────────────────────┘


┌─────────────────────────────────────┐
│ 9. Code Review & Merge │
│ ───────────────────────────────────│
│ • Get team approval │
│ • Merge to develop │
│ • Delete bugfix branch │
└───────────┬─────────────────────────┘


┌──────────────┐
│ END │
└──────────────┘

Detailed Steps

Step 1: Document the Bug

Before starting, gather information:

**Bug Report:**
- Ticket: NS-456
- Script: vendor_invoice_suitelet.js
- Error: "Cannot read property 'getValue' of null"
- Steps to reproduce:
1. Open Suitelet
2. Leave vendor field empty
3. Click Submit
- Expected: Validation error message
- Actual: Script crashes

Step 2-3: Create Bugfix Branch

git checkout develop
git pull origin develop
git checkout -b bugfix/vendor-NS456-null-vendor-check

Step 4: Locate Issue in VSCode

Using SuiteScript Debugger:

  1. Open script file in VSCode
  2. Set breakpoints on suspicious lines
  3. Ctrl+Shift+P → "SuiteCloud: Debug SuiteScript"
  4. Trigger the bug scenario
  5. Inspect variable values

Checking NetSuite Execution Log:

  1. Go to Customization → Scripting → Script Execution Logs
  2. Filter by your script
  3. Look for error stack traces

Step 5: Implement Minimal Fix

// BEFORE (buggy)
const vendorId = record.getValue({ fieldId: 'entity' });
const vendorName = search.lookupFields({
type: 'vendor',
id: vendorId, // Crashes if vendorId is null
columns: ['companyname']
});

// AFTER (fixed)
const vendorId = record.getValue({ fieldId: 'entity' });
if (!vendorId) {
throw error.create({
name: 'MISSING_VENDOR',
message: 'Please select a vendor before submitting.'
});
}
const vendorName = search.lookupFields({
type: 'vendor',
id: vendorId,
columns: ['companyname']
});

Step 6: Test in Sandbox

Ctrl+Shift+P → SuiteCloud: Deploy to Account
→ Select Sandbox
→ Test the fix
→ Verify no side effects

Step 7-9: Commit and PR

# Commit with clear message
git add .
git commit -m "[NS-456] Fix: Add null check for vendor field

Root cause: Script crashed when vendor field was empty
Fix: Added validation before vendor lookup
Testing: Verified in sandbox, error message now displays correctly"

# Push and create PR
git push -u origin bugfix/vendor-NS456-null-vendor-check

Bugfix Best Practices

DoDon't
Make minimal changesRefactor unrelated code
Document root causeJust fix symptoms
Test regressionOnly test the fix
Reference ticket numberUse vague commit messages

Hotfix Workflow

When to Use

Critical Situations Only
  • Production is broken for users
  • Security vulnerability discovered
  • Data corruption occurring
  • Financial calculations incorrect

Always notify IT Lead before starting a hotfix!

Flow Diagram

┌─────────────────────────────────────────────────────────────────────────────────┐
│ HOTFIX WORKFLOW │
│ (Critical Production Fixes) │
└─────────────────────────────────────────────────────────────────────────────────┘

┌──────────────┐
│ START │
│ (Production │
│ is broken!) │
└──────┬───────┘


┌─────────────────────────────────────┐
│ 1. NOTIFY IT LEAD IMMEDIATELY │
│ ───────────────────────────────────│
│ • Call or message IT Lead │
│ • Describe the issue │
│ • Get approval to proceed │
└───────────┬─────────────────────────┘


┌─────────────────────────────────────┐
│ 2. Create hotfix from MAIN │
│ ───────────────────────────────────│
│ git checkout main │
│ git pull origin main │
│ git checkout -b hotfix/NS-XXX-desc │
└───────────┬─────────────────────────┘


┌─────────────────────────────────────┐
│ 3. Implement emergency fix │
│ ───────────────────────────────────│
│ • Focus ONLY on the critical issue │
│ • No refactoring or improvements │
│ • Minimal code changes │
└───────────┬─────────────────────────┘


┌─────────────────────────────────────┐
│ 4. Test quickly but thoroughly │
│ ───────────────────────────────────│
│ • Deploy to Sandbox first │
│ • Verify fix works │
│ • Quick regression check │
└───────────┬─────────────────────────┘


┌──────────────┐ No ┌─────────────────┐
│ Fix works? ├──────────►│ Continue fixing │
└──────┬───────┘ └────────┬────────┘
│ Yes │
│ ◄───────────────────────┘

┌─────────────────────────────────────┐
│ 5. Commit and push │
│ ───────────────────────────────────│
│ git add . │
│ git commit -m "[NS-XXX] HOTFIX: x" │
│ git push -u origin hotfix/NS-XXX │
└───────────┬─────────────────────────┘


┌─────────────────────────────────────┐
│ 6. Create PR to MAIN │
│ ───────────────────────────────────│
│ • Target: main (NOT develop!) │
│ • Request emergency review │
│ • Mark as urgent/critical │
└───────────┬─────────────────────────┘


┌─────────────────────────────────────┐
│ 7. Emergency code review │
│ ───────────────────────────────────│
│ • Quick but careful review │
│ • Focus on fix correctness │
│ • IT Lead approval required │
└───────────┬─────────────────────────┘


┌─────────────────────────────────────┐
│ 8. Merge to MAIN │
│ ───────────────────────────────────│
│ • Squash and merge │
│ • Do NOT delete branch yet │
└───────────┬─────────────────────────┘


┌─────────────────────────────────────┐
│ 9. Deploy to PRODUCTION │
│ ───────────────────────────────────│
│ • SDF Deploy to Production │
│ • Verify fix in production │
│ • Monitor for issues │
└───────────┬─────────────────────────┘


┌─────────────────────────────────────┐
│ 10. Sync hotfix to develop │
│ ───────────────────────────────────│
│ git checkout develop │
│ git pull origin develop │
│ git merge main │
│ git push origin develop │
└───────────┬─────────────────────────┘


┌─────────────────────────────────────┐
│ 11. Cleanup │
│ ───────────────────────────────────│
│ git branch -d hotfix/NS-XXX │
│ git push origin --delete hotfix/.. │
│ • Document incident │
│ • Post-mortem if needed │
└───────────┬─────────────────────────┘


┌──────────────┐
│ END │
└──────────────┘

Visual: Hotfix Branch Flow

         Hotfix created     Merge to main      Sync to develop
│ │ │
▼ ▼ ▼
main ────●──────────────────●─────────────────────●────► Production
│ ▲ │
│ │ │
└──► hotfix/NS999 ─┘ │

develop ─────────────────────────────────────────────●────► Integration
(synced)

Detailed Steps

Step 1: Notify IT Lead

Before writing any code:

Message/Call IT Lead:
"URGENT: Production issue with [script/feature]
Impact: [describe user impact]
Error: [error message if available]
I'm ready to create a hotfix. Approval to proceed?"

Step 2: Create Hotfix from Main

# IMPORTANT: Branch from main, not develop!
git checkout main
git pull origin main
git checkout -b hotfix/NS999-fix-payment-calculation

Step 3: Implement Emergency Fix

Keep it minimal:

// ONLY fix the immediate issue
// Example: Fixing a calculation error

// BEFORE
const total = subtotal * taxRate; // Wrong formula

// AFTER
const total = subtotal * (1 + taxRate); // Correct formula

// Do NOT also refactor, add features, or "improve" other code

Step 4: Quick Testing

# Deploy to Sandbox first (ALWAYS)
Ctrl+Shift+P → SuiteCloud: Deploy to Account → Sandbox

# Test the specific scenario that was failing
# Do quick regression check on related functionality

Step 5-6: Commit and Create PR to Main

git add .
git commit -m "[NS-999] HOTFIX: Correct payment calculation formula

CRITICAL: Payment amounts were being calculated incorrectly
Impact: All payments since [date] affected
Fix: Corrected tax calculation formula
Tested: Verified in sandbox with sample transactions"

git push -u origin hotfix/NS999-fix-payment-calculation

Create PR on GitHub:

  • Base: main ← Compare: hotfix/NS999-fix-payment-calculation
  • Title: [HOTFIX] NS-999: Fix payment calculation
  • Add "urgent" or "critical" label
  • Request IT Lead as reviewer

Step 7-8: Emergency Review and Merge

  • IT Lead reviews and approves
  • Merge using "Squash and merge"

Step 9: Deploy to Production

# Deploy to Production account via SDF
Ctrl+Shift+P → SuiteCloud: Deploy to Account → Production

# Or via terminal
suitecloud project:deploy --account PRODUCTION_ACCOUNT_ID

Post-deployment verification:

  1. Test the fix in production
  2. Check Script Execution Logs for errors
  3. Monitor for 15-30 minutes

Step 10: Sync to Develop

# This ensures develop has the fix too
git checkout develop
git pull origin develop
git merge main
git push origin develop

Step 11: Cleanup and Document

# Delete local and remote hotfix branch
git branch -d hotfix/NS999-fix-payment-calculation
git push origin --delete hotfix/NS999-fix-payment-calculation

Document the incident:

## Hotfix Report - NS-999

**Date:** 2024-01-15
**Severity:** Critical
**Resolution Time:** 45 minutes

**Issue:** Payment calculation formula incorrect
**Root Cause:** Tax rate was multiplied instead of added
**Fix:** Corrected formula in payment_processor.js line 234
**Impact:** ~50 transactions affected, corrections applied

**Lessons Learned:**
- Add unit tests for calculation functions
- Review formulas more carefully in code review

Hotfix Checklist

StepCompleted
IT Lead notified
Branch from main (not develop)
Fix is minimal and focused
Tested in Sandbox
PR targets main branch
IT Lead approved
Deployed to Production
Verified in Production
Synced to develop
Branch deleted
Incident documented

SDF Project Structure Reference

For all workflows, your SDF project should follow this structure:

📁 MyNetSuiteProject/
├── 📄 suitecloud.config.js # SDF configuration
├── 📄 manifest.xml # Deployment manifest
├── 📁 src/
│ ├── 📁 FileCabinet/
│ │ └── 📁 SuiteScripts/
│ │ ├── 📁 Suitelets/ # Suitelet scripts
│ │ ├── 📁 UserEvents/ # User Event scripts
│ │ ├── 📁 ClientScripts/# Client scripts
│ │ ├── 📁 MapReduce/ # Map/Reduce scripts
│ │ ├── 📁 RESTlets/ # RESTlet scripts
│ │ └── 📁 Libraries/ # Shared libraries
│ ├── 📁 Objects/
│ │ ├── customrecord_*.xml # Custom records
│ │ ├── customfield_*.xml # Custom fields
│ │ ├── workflow_*.xml # Workflows
│ │ └── savedsearch_*.xml # Saved searches
│ └── 📁 Templates/
│ └── *.html # HTML templates
└── 📁 .git/ # Git repository

VSCode SDF Commands Quick Reference

ActionCommand Palette (Ctrl+Shift+P)
Set up accountSuiteCloud: Set Up Account
Create scriptSuiteCloud: Create SuiteScript
Import objectsSuiteCloud: Import Objects
Validate projectSuiteCloud: Validate Project
Deploy to accountSuiteCloud: Deploy to Account
Debug scriptSuiteCloud: Debug SuiteScript

Quick Reference

ScenarioBranch FromMerge ToPrefixUrgency
New featuredevelopdevelopfeature/Normal
Bug fixdevelopdevelopbugfix/Normal
Hotfixmainmain → develophotfix/Critical

Branch Naming

[type]/[team]-[TICKET]-[short-description]

Examples:

  • feature/vendor-NS123-invoice-automation
  • bugfix/it-NS456-fix-calculation
  • hotfix/NS999-critical-payment-fix