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 Type | Source | Target | Purpose |
|---|---|---|---|
feature/ | develop | develop | New functionality |
bugfix/ | develop | develop | Non-critical fixes |
hotfix/ | main | main → develop | Critical 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
- Open your SDF project folder in VSCode
- Verify authentication:
- Press
Ctrl+Shift+P→ Type "SuiteCloud: Set Up Account" - Or check terminal:
suitecloud account:setup
- Press
- 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:
| Type | Location |
|---|---|
| SuiteScripts | src/FileCabinet/SuiteScripts/ |
| Custom Records | src/Objects/customrecord_*.xml |
| Custom Fields | src/Objects/customfield_*.xml |
| Workflows | src/Objects/workflow_*.xml |
| Saved Searches | src/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:
- Navigate to your repository
- Click "Compare & pull request"
- Set base: develop ← compare: feature/vendor-NS123-new-suitelet
- Fill in the PR template
- 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:
- Open script file in VSCode
- Set breakpoints on suspicious lines
Ctrl+Shift+P→ "SuiteCloud: Debug SuiteScript"- Trigger the bug scenario
- Inspect variable values
Checking NetSuite Execution Log:
- Go to Customization → Scripting → Script Execution Logs
- Filter by your script
- 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
| Do | Don't |
|---|---|
| Make minimal changes | Refactor unrelated code |
| Document root cause | Just fix symptoms |
| Test regression | Only test the fix |
| Reference ticket number | Use 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:
- Test the fix in production
- Check Script Execution Logs for errors
- 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
| Step | Completed |
|---|---|
| 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
| Action | Command Palette (Ctrl+Shift+P) |
|---|---|
| Set up account | SuiteCloud: Set Up Account |
| Create script | SuiteCloud: Create SuiteScript |
| Import objects | SuiteCloud: Import Objects |
| Validate project | SuiteCloud: Validate Project |
| Deploy to account | SuiteCloud: Deploy to Account |
| Debug script | SuiteCloud: Debug SuiteScript |
Quick Reference
| Scenario | Branch From | Merge To | Prefix | Urgency |
|---|---|---|---|---|
| New feature | develop | develop | feature/ | Normal |
| Bug fix | develop | develop | bugfix/ | Normal |
| Hotfix | main | main → develop | hotfix/ | Critical |
Branch Naming
[type]/[team]-[TICKET]-[short-description]
Examples:
feature/vendor-NS123-invoice-automationbugfix/it-NS456-fix-calculationhotfix/NS999-critical-payment-fix