Deploying consists of 14% of total score in Salesforce Platform Lifecycle and Deployment Architect Exam. The topic covers metadata/tooling api, and pre-development/development/post-development steps.

NOTE

Most of the content in this work was generated with the assistance of AI and carefully reviewed, edited, and curated by the author. If you have found any issues with the content on this page, please do not hesitate to contact me atΒ support@issacc.com.

πŸš€ Deploying in Salesforce

Goal: Learn to use Metadata API & Tooling API for deployments, handle pre/post steps, and manage technical reference data.


🧩 Metadata API vs Tooling API

Aspect🧬 Metadata APIπŸ› οΈ Tooling API
PurposeMove large sets of metadata between orgsFine-grained access to smaller metadata pieces
Use casesDeploy, retrieve, update, delete metadataRetrieve/manage fields, Apex, run tests
Access methodsdeploy(), retrieve(), CLI, VS Code Ext.SOQL via REST/SOAP, query(), create(), etc.
Component scopeWorks with metadata types & componentsWorks with objects like ApexClass, CustomField
File limits≀ 10,000 files, ≀ 39 MB zipNo file-based deployment, just object data
Key limitationSome types not supportedEntityDefinition & FieldDefinition have SOQL/SOSL limits

πŸ“¦ Metadata API β€” Key Points

  • Operations: Deploy, retrieve, create, update, delete metadata
  • Deployment: Moves metadata from local β†’ scratch org β†’ sandbox β†’ production
  • Structure: Uses package.xml manifest + .xml components in zip
  • Destructive Changes: Delete components via destructiveChanges.xml
  • Custom Metadata Types: Defined as CustomObject, with .mdt suffix

⚠️ Limits

  • Max 10,000 files or 39 MB zip
  • Some metadata types must be deployed manually

βš™οΈ Tooling API β€” Key Points

  • Operations: Retrieve small metadata pieces (fields, validation rules, Apex, etc.)
  • Use Cases: Interactive apps, dynamic Lightning tools, run tests, check code coverage
  • Access: REST /query/?q=... or SOAP create()/update() calls
  • Warnings: Can ignore save warnings via ignoreSaveWarnings header

⚠️ Limits

  • No COUNT(), GROUP BY, LIMIT, OR, NOT on EntityDefinition / FieldDefinition
  • Some CRUD ops not supported for active org ApexClass/ApexPage/CustomObject

🧠 Choosing Which API

πŸ’‘ Use Metadata API when:

  • Deploying large volumes or doing full org migrations
  • Moving metadata between environments with source control
  • Doing production-level changes

πŸ’‘ Use Tooling API when:

  • Need fine-grained metadata for tools or external apps
  • Working with field definitions, Apex tests, code coverage

πŸ“‹ Pre / Post Deployment Steps

⏳ Pre-Deployment

Ensure a smooth and safe release

βœ… Planning, notifying/freezing users
βœ… Sandbox testing
βœ… Check audit trail
βœ… Document manual steps (unsupported items like org-wide email)
βœ… Backup data & metadata
βœ… Deactivate automation (Validation Rules, Flows, Triggers, Emails)
βœ… Prepare test scripts, user training
βœ… Select deployment tool & build package
βœ… Validate deployment, plan deployment order


⚑ Deployment

Execute the deployment

  • Use Change Sets or Metadata API
  • Validate before actual deploy
  • Deploy in correct dependency order

βœ… Post-Deployment

Confirm everything works as intended

πŸ” Reactivate automation & email
πŸ“Š Post-deployment testing
πŸ“ Perform manual changes
πŸ“¦ Migrate data (if new fields/structures)
πŸ–₯️ Monitor new features and support users
πŸ“’ Update docs, communicate changes, train users


πŸ“š Technical Reference Data

ConceptDescription
πŸ“– PurposeCategorize data, standardize terms, ensure consistency
βš™οΈ ExamplesPicklist values, configuration settings
🧩 StorageCustom Metadata Types (best for deployable data)
🧠 ConsiderationsSource of truth, governance, object relationships, governor limits
🚚 DeploymentMetadata API (complex/large) or Change Sets (simple)
πŸ’Ύ Data LoaderLoad/export large volumes of reference data

⚠️ Watch out

  • Circular object relationships β†’ cause integrity & query issues
  • Apex governor limits on nested relationships

πŸ’Ό Business Scenarios β€” Key Takeaways

πŸ” Cosmic Food Innovations

  • Use retrieve() β†’ scratch org β†’ deploy() β†’ sandbox β†’ production
  • Export reports/dashboards as XML daily to prevent rollback
  • Delete components via destructiveChanges.xml
  • Match script API version to features (59.0+)
  • Block direct prod changes; automate with Metadata API

🌍 Cosmic Food – New EU Org

  • Large deployment β†’ group by dependency, deploy in order
  • Watch Metadata API limits: 10k files, 39 MB
  • External Java app β†’ use Tooling API + SOQL

🌱 Cosmic Green Innovations

  • Document manual steps (org-wide email), deploy with Metadata API
  • Data migration order: Accounts β†’ Contacts β†’ Leads β†’ Products β†’ Oops β†’ Opp Line Items
  • Validate Change Sets before deployment
  • Dashboards preserve user fields β€” usernames must match target org
  • Test data migration: case links, owners, entitlements, milestones

πŸ₯ Cosmic Health Innovations

  • Use Salesforce as source of truth for data, Git for metadata
  • Use Data Loader to load large volumes
  • Beware circular relationships and governor limits
  • Service centers β†’ store as Custom Metadata Type, deploy via Metadata API/Change Sets

πŸ“ Quick Memory Cheats

TaskUseNotes
Large metadata deploymentsMetadata APIUse package.xml and zip
Small metadata tweaksTooling APIUse SOQL + REST/SOAP
Delete metadataMetadata APIdestructiveChanges.xml
Prevent rollbackMetadata APIExport XML daily
Unsupported itemsManualPlan before deploy
Technical ref dataCustom Metadata TypesDeploy via Metadata API

πŸ’‘ Pro Tips

🧠 Remember these to ace the exam:

  • Always validate before deploy
  • Always reactivate what you disabled
  • Always test & document changes
  • Always plan dependencies & data order

πŸ“ˆ Flow Charts

πŸŒ€ Deployment Lifecycle

flowchart TD
    Start --> Develop
    Develop --> ScratchOrg
    ScratchOrg --> Test
    Test --> RetrieveToRepo
    RetrieveToRepo --> Sandbox
    Sandbox --> ValidateSandbox
    ValidateSandbox --> AllTestsPass
    AllTestsPass -->|No| Test
    AllTestsPass -->|Yes| FreezeUsers
    FreezeUsers --> ValidateProd
    ValidateProd --> QuickDeploy
    QuickDeploy -->|Yes| DeployProd
    QuickDeploy -->|No| FullDeploy
    DeployProd --> PostDeploy
    FullDeploy --> PostDeploy
    PostDeploy --> ReenableAutomation
    ReenableAutomation --> Monitor
    Monitor --> Done

βš–οΈ Choosing the Right API

flowchart TD
    Need --> Scope
    Scope -->|Large| MetadataAPI
    Scope -->|Small| ToolingAPI

    MetadataAPI --> DeployRetrieve
    MetadataAPI --> BigLimit
    MetadataAPI --> DestructiveDelete

    ToolingAPI --> SOQLQueries
    ToolingAPI --> ApexTests
    ToolingAPI --> SOSLLimits

🧩 Pre-Deployment Steps

flowchart TD
    Plan --> SandboxTest
    SandboxTest --> AuditTrail
    AuditTrail --> Backup
    Backup --> ManualSteps
    ManualSteps --> DeactivateAutomation
    DeactivateAutomation --> DisableEmail
    DisableEmail --> PrepareScripts
    PrepareScripts --> BuildPackage
    BuildPackage --> Validate
    Validate --> OrderCheck
    OrderCheck --> Ready

βœ… Post-Deployment Steps

flowchart TD
    DeployDone --> RunTests
    RunTests --> ReenableAutomation
    ReenableAutomation --> EnableEmail
    EnableEmail --> ManualConfig
    ManualConfig --> DataMigration
    DataMigration --> Monitor
    Monitor --> SupportUsers
    SupportUsers --> UpdateDocs
    UpdateDocs --> Done

πŸ—‘οΈ Deleting Components (destructiveChanges.xml)

flowchart TD
    NeedDelete --> CreateDestructive
    CreateDestructive --> ListComponents
    ListComponents --> ValidateDelete
    ValidateDelete --> PassCheck
    PassCheck -->|No| FixDependencies
    FixDependencies --> ValidateDelete
    PassCheck -->|Yes| DeployDelete
    DeployDelete --> ConfirmCleanup

πŸ“¦ Data Migration Order

flowchart TD
    Start --> Accounts
    Accounts --> Contacts
    Contacts --> Leads
    Leads --> Products
    Products --> Opportunities
    Opportunities --> OppLineItems
    OppLineItems --> ValidateLinks
    ValidateLinks --> Done

πŸ“š Flashcards

🧩 Metadata vs Tooling API


⚑ Pre-Deployment


πŸ§ͺ Post-Deployment


πŸ—‘οΈ Deletion via destructiveChanges.xml


🧠 Technical Reference Data


πŸ“¦ Data Migration Order