salesforce-migration-deep-dive

Execute Salesforce data migrations using Bulk API, Data Loader, and ETL patterns. Use when migrating data to/from Salesforce, performing org-to-org migrations, or re-platforming CRM data into Salesforce. Trigger with phrases like "migrate to salesforce", "salesforce data migration", "salesforce import data", "salesforce ETL", "CRM migration to salesforce".

1,868 stars

Best use case

salesforce-migration-deep-dive is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Execute Salesforce data migrations using Bulk API, Data Loader, and ETL patterns. Use when migrating data to/from Salesforce, performing org-to-org migrations, or re-platforming CRM data into Salesforce. Trigger with phrases like "migrate to salesforce", "salesforce data migration", "salesforce import data", "salesforce ETL", "CRM migration to salesforce".

Teams using salesforce-migration-deep-dive should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/salesforce-migration-deep-dive/SKILL.md --create-dirs "https://raw.githubusercontent.com/jeremylongshore/claude-code-plugins-plus-skills/main/plugins/saas-packs/salesforce-pack/skills/salesforce-migration-deep-dive/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/salesforce-migration-deep-dive/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How salesforce-migration-deep-dive Compares

Feature / Agentsalesforce-migration-deep-diveStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Execute Salesforce data migrations using Bulk API, Data Loader, and ETL patterns. Use when migrating data to/from Salesforce, performing org-to-org migrations, or re-platforming CRM data into Salesforce. Trigger with phrases like "migrate to salesforce", "salesforce data migration", "salesforce import data", "salesforce ETL", "CRM migration to salesforce".

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

# Salesforce Migration Deep Dive

## Overview
Comprehensive guide for migrating data to/from Salesforce: ETL patterns using Bulk API 2.0, data mapping between CRM schemas, record relationship preservation, and validation.

## Prerequisites
- Source and target Salesforce orgs (or external CRM)
- jsforce with Bulk API 2.0 access
- Understanding of sObject relationships and External IDs
- Staging sandbox for dry runs

## Migration Types

| Type | Complexity | Duration | Tool |
|------|-----------|----------|------|
| CSV import (< 50K records) | Low | Hours | Data Import Wizard / Bulk API |
| CRM-to-Salesforce | Medium | Weeks | Custom ETL with jsforce |
| Org-to-org migration | Medium | Weeks | SFDX + Bulk API |
| Full re-platform | High | Months | Custom ETL + change management |

## Instructions

### Step 1: Data Assessment

```typescript
const conn = await getConnection();

// Count records per object
const objectCounts = await Promise.all(
  ['Account', 'Contact', 'Lead', 'Opportunity', 'Case'].map(async (obj) => {
    const result = await conn.query(`SELECT COUNT(Id) total FROM ${obj}`);
    return { object: obj, count: result.records[0].total };
  })
);

console.table(objectCounts);
// Account:      15,234
// Contact:      45,678
// Lead:         23,456
// Opportunity:  8,901
// Case:         67,890

// Check data storage limits
const limits = await conn.request('/services/data/v59.0/limits/');
console.log(`Data storage: ${limits.DataStorageMB.Max - limits.DataStorageMB.Remaining}/${limits.DataStorageMB.Max} MB`);
```

### Step 2: Schema Mapping

```typescript
// Map source fields to Salesforce sObject fields
interface FieldMapping {
  source: string;
  target: string;
  transform?: (value: any) => any;
  required: boolean;
}

const accountMappings: FieldMapping[] = [
  { source: 'company_name', target: 'Name', required: true },
  { source: 'industry_code', target: 'Industry', required: false,
    transform: (code) => INDUSTRY_MAP[code] || 'Other' },
  { source: 'annual_rev', target: 'AnnualRevenue', required: false,
    transform: (v) => typeof v === 'string' ? parseFloat(v.replace(/[$,]/g, '')) : v },
  { source: 'website_url', target: 'Website', required: false },
  { source: 'employee_count', target: 'NumberOfEmployees', required: false },
  { source: 'external_id', target: 'External_ID__c', required: true },
];

function transformRecord(
  source: Record<string, any>,
  mappings: FieldMapping[]
): Record<string, any> {
  const target: Record<string, any> = {};
  for (const mapping of mappings) {
    let value = source[mapping.source];
    if (value === undefined || value === null) {
      if (mapping.required) throw new Error(`Missing required field: ${mapping.source}`);
      continue;
    }
    if (mapping.transform) value = mapping.transform(value);
    target[mapping.target] = value;
  }
  return target;
}
```

### Step 3: Migration Order (Respecting Relationships)

```
Migration order matters! Parent objects must be loaded before children.

1. Account          (no dependencies)
2. Contact          (depends on Account via AccountId)
3. Opportunity      (depends on Account via AccountId)
4. OpportunityContactRole (depends on Opportunity + Contact)
5. Case             (depends on Account + Contact)
6. Task / Event     (depends on Contact via WhoId, Account via WhatId)

Use External IDs to resolve relationships without knowing Salesforce IDs:
- Create External_ID__c on Account, Contact, Opportunity
- Use external ID references in child records
```

### Step 4: Bulk Migration with External ID Relationships

```typescript
import { getConnection } from './salesforce/connection';
import fs from 'fs';

const conn = await getConnection();

// Step 4a: Load Accounts first
const accountCsv = `Name,Industry,External_ID__c
Acme Corp,Technology,EXT-ACME-001
Globex Inc,Manufacturing,EXT-GLOBEX-002
Initech LLC,Consulting,EXT-INITECH-003`;

const accountResults = await conn.bulk2.loadAndWaitForResults({
  object: 'Account',
  operation: 'upsert',
  externalIdFieldName: 'External_ID__c',
  input: accountCsv,
});
console.log(`Accounts: ${accountResults.successfulResults.length} success, ${accountResults.failedResults.length} failed`);

// Step 4b: Load Contacts with Account relationship via External ID
const contactCsv = `FirstName,LastName,Email,Account.External_ID__c,External_ID__c
Jane,Smith,jane@acme.com,EXT-ACME-001,EXT-CONTACT-001
John,Doe,john@globex.com,EXT-GLOBEX-002,EXT-CONTACT-002`;

const contactResults = await conn.bulk2.loadAndWaitForResults({
  object: 'Contact',
  operation: 'upsert',
  externalIdFieldName: 'External_ID__c',
  input: contactCsv,
});
// Account.External_ID__c resolves to the correct AccountId automatically!
```

### Step 5: Validation

```typescript
async function validateMigration(
  sourceCount: number,
  objectType: string
): Promise<{ passed: boolean; details: string }> {
  const conn = await getConnection();

  // Count migrated records
  const result = await conn.query(
    `SELECT COUNT(Id) total FROM ${objectType} WHERE External_ID__c != null`
  );
  const targetCount = result.records[0].total;

  // Check for orphaned relationships
  let orphans = 0;
  if (objectType === 'Contact') {
    const orphanResult = await conn.query(
      `SELECT COUNT(Id) total FROM Contact WHERE AccountId = null AND External_ID__c != null`
    );
    orphans = orphanResult.records[0].total;
  }

  const passed = targetCount === sourceCount && orphans === 0;
  return {
    passed,
    details: `Source: ${sourceCount}, Target: ${targetCount}, Orphans: ${orphans}`,
  };
}
```

### Step 6: Rollback Plan

```typescript
// Delete migrated records using External ID marker
async function rollbackMigration(objectType: string): Promise<void> {
  const conn = await getConnection();

  // Query all migrated records (identified by External_ID__c)
  const records = await conn.query(
    `SELECT Id FROM ${objectType} WHERE External_ID__c != null`
  );

  // Delete in reverse order (children first)
  const ids = records.records.map((r: any) => r.Id);
  for (let i = 0; i < ids.length; i += 200) {
    const batch = ids.slice(i, i + 200);
    await conn.sobject(objectType).destroy(batch);
  }

  console.log(`Rolled back ${ids.length} ${objectType} records`);
}
```

## Output
- Data assessment with record counts and storage usage
- Field mapping layer transforming source to Salesforce schema
- Bulk API migration respecting parent-child relationships
- External ID-based relationship resolution (no hardcoded IDs)
- Validation and rollback procedures

## Error Handling
| Error | Cause | Solution |
|-------|-------|----------|
| `DUPLICATE_VALUE` on External_ID__c | Re-running migration | Use upsert instead of insert |
| `INVALID_CROSS_REFERENCE_KEY` | Parent record not found | Verify parent loaded first, check External ID values |
| `STORAGE_LIMIT_EXCEEDED` | Org storage full | Delete test data or upgrade storage |
| Bulk job timeout | Very large dataset | Split into smaller jobs (< 100M records) |
| Field mapping errors | Source schema mismatch | Validate transform functions with sample data first |

## Resources
- [Bulk API 2.0](https://developer.salesforce.com/docs/atlas.en-us.api_asynch.meta/api_asynch/bulk_api_2_0.htm)
- [External ID Fields](https://help.salesforce.com/s/articleView?id=sf.fields_about_external_ids.htm)
- [Data Import Best Practices](https://help.salesforce.com/s/articleView?id=sf.importing_data.htm)
- [Salesforce Data Loader](https://developer.salesforce.com/docs/atlas.en-us.dataLoader.meta/dataLoader/)

## Next Steps
For advanced troubleshooting, see `salesforce-advanced-troubleshooting`.

Related Skills

workhuman-upgrade-migration

1868
from jeremylongshore/claude-code-plugins-plus-skills

Workhuman upgrade migration for employee recognition and rewards API. Use when integrating Workhuman Social Recognition, or building recognition workflows with HRIS systems. Trigger: "workhuman upgrade migration".

wispr-upgrade-migration

1868
from jeremylongshore/claude-code-plugins-plus-skills

Wispr Flow upgrade migration for voice-to-text API integration. Use when integrating Wispr Flow dictation, WebSocket streaming, or building voice-powered applications. Trigger: "wispr upgrade migration".

windsurf-upgrade-migration

1868
from jeremylongshore/claude-code-plugins-plus-skills

Upgrade Windsurf IDE, migrate settings from VS Code or Cursor, and handle breaking changes. Use when upgrading Windsurf versions, migrating from another editor, or handling configuration changes after updates. Trigger with phrases like "upgrade windsurf", "windsurf update", "migrate to windsurf", "windsurf from cursor", "windsurf from vscode".

windsurf-migration-deep-dive

1868
from jeremylongshore/claude-code-plugins-plus-skills

Migrate to Windsurf from VS Code, Cursor, or other AI IDEs with full configuration transfer. Use when migrating a team to Windsurf, transferring Cursor rules, or evaluating Windsurf against other AI editors. Trigger with phrases like "migrate to windsurf", "switch to windsurf", "windsurf from cursor", "windsurf from copilot", "windsurf evaluation".

webflow-upgrade-migration

1868
from jeremylongshore/claude-code-plugins-plus-skills

Analyze, plan, and execute Webflow SDK upgrades (webflow-api v1 to v3) with breaking change detection, API v1-to-v2 migration, and deprecation handling. Trigger with phrases like "upgrade webflow", "webflow migration", "webflow breaking changes", "update webflow SDK", "webflow v1 to v2".

webflow-migration-deep-dive

1868
from jeremylongshore/claude-code-plugins-plus-skills

Execute major Webflow migrations — from other CMS platforms to Webflow CMS, between Webflow sites, or large-scale content re-architecture using the Data API v2 bulk endpoints, strangler fig pattern, and data validation. Trigger with phrases like "migrate to webflow", "webflow migration", "import into webflow", "webflow replatform", "move content to webflow", "webflow bulk import", "wordpress to webflow".

vercel-upgrade-migration

1868
from jeremylongshore/claude-code-plugins-plus-skills

Upgrade Vercel CLI, Node.js runtime, and Next.js framework versions with breaking change detection. Use when upgrading Vercel CLI versions, migrating Node.js runtimes, or updating Next.js between major versions on Vercel. Trigger with phrases like "upgrade vercel", "vercel migration", "vercel breaking changes", "update vercel CLI", "next.js upgrade on vercel".

vercel-migration-deep-dive

1868
from jeremylongshore/claude-code-plugins-plus-skills

Migrate to Vercel from other platforms or re-architecture existing Vercel deployments. Use when migrating from Netlify, AWS, or Cloudflare to Vercel, or when re-platforming an existing Vercel application. Trigger with phrases like "migrate to vercel", "vercel migration", "switch to vercel", "netlify to vercel", "aws to vercel", "vercel replatform".

veeva-upgrade-migration

1868
from jeremylongshore/claude-code-plugins-plus-skills

Veeva Vault upgrade migration for REST API and clinical operations. Use when working with Veeva Vault document management and CRM. Trigger: "veeva upgrade migration".

veeva-migration-deep-dive

1868
from jeremylongshore/claude-code-plugins-plus-skills

Veeva Vault migration deep dive for enterprise operations. Use when implementing advanced Veeva Vault patterns. Trigger: "veeva migration deep dive".

vastai-upgrade-migration

1868
from jeremylongshore/claude-code-plugins-plus-skills

Upgrade Vast.ai CLI, migrate API versions, and handle breaking changes. Use when upgrading vastai CLI, detecting deprecations, or migrating between API versions. Trigger with phrases like "upgrade vastai", "vastai migration", "vastai breaking changes", "update vastai CLI".

vastai-migration-deep-dive

1868
from jeremylongshore/claude-code-plugins-plus-skills

Migrate GPU workloads to or from Vast.ai, or between GPU providers. Use when switching from AWS/GCP/Azure GPU instances to Vast.ai, migrating between GPU types, or re-platforming ML infrastructure. Trigger with phrases like "migrate to vastai", "vastai migration", "switch to vastai", "vastai from aws", "vastai from lambda".