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 |
---|---|---|
Purpose | Move large sets of metadata between orgs | Fine-grained access to smaller metadata pieces |
Use cases | Deploy, retrieve, update, delete metadata | Retrieve/manage fields, Apex, run tests |
Access methods | deploy() , retrieve() , CLI, VS Code Ext. | SOQL via REST/SOAP, query() , create() , etc. |
Component scope | Works with metadata types & components | Works with objects like ApexClass, CustomField |
File limits | β€ 10,000 files, β€ 39 MB zip | No file-based deployment, just object data |
Key limitation | Some types not supported | EntityDefinition & 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 SOAPcreate()/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
Concept | Description |
---|---|
π Purpose | Categorize data, standardize terms, ensure consistency |
βοΈ Examples | Picklist values, configuration settings |
π§© Storage | Custom Metadata Types (best for deployable data) |
π§ Considerations | Source of truth, governance, object relationships, governor limits |
π Deployment | Metadata API (complex/large) or Change Sets (simple) |
πΎ Data Loader | Load/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
Task | Use | Notes |
---|---|---|
Large metadata deployments | Metadata API | Use package.xml and zip |
Small metadata tweaks | Tooling API | Use SOQL + REST/SOAP |
Delete metadata | Metadata API | destructiveChanges.xml |
Prevent rollback | Metadata API | Export XML daily |
Unsupported items | Manual | Plan before deploy |
Technical ref data | Custom Metadata Types | Deploy 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
What is the main use of Metadata API?
π¦ Move large sets of metadata between orgs (deploy, retrieve, update, delete); suitable for big deployments and production-level changes.
What is the main use of Tooling API?
βοΈ Fine-grained access to smaller metadata pieces (custom fields, Apex, tests, code coverage); ideal for interactive tools.
What are the limitations of Metadata API?
β Up to 10,000 files per deploy/retrieve, 39 MB max zip; some types unsupported and must be deployed manually.
What are the limitations of Tooling API?
β οΈ No COUNT/GROUP BY/LIMIT on EntityDefinition or FieldDefinition; some CRUD ops not supported on ApexClass/ApexPage/CustomObject.
β‘ Pre-Deployment
What are the key pre-deployment steps?
π Plan release, sandbox test, audit trail, back up data/metadata, document manual steps, deactivate automation, disable emails, prepare test scripts, validate deployment, check dependency order.
Why freeze users during deployment?
π§ Prevent data changes that could conflict with deployment and ensure data integrity.
What should be done with automation and emails pre-deploy?
β‘ Temporarily deactivate Validation Rules, Flows, Triggers and disable email deliverability to prevent errors and spam.
π§ͺ Post-Deployment
What are the key post-deployment steps?
β Post-deploy testing, re-enable automation, enable emails, perform manual config changes, run data migration, monitor features, support users, update docs, communicate changes.
Why test after deployment?
π§ To verify all components work as expected in production and interact properly with existing features.
ποΈ Deletion via destructiveChanges.xml
How to delete deployed components?
ποΈ Use
destructiveChanges.xml
withpackage.xml
and deploy like normal; it removes listed components.
What is important to do before deploying destructive changes?
β οΈ Validate delete package and resolve any references/dependencies to prevent failures.
π§ Technical Reference Data
What is technical reference data?
𧬠Data used to categorize other data, standardize terminology, and ensure consistency (e.g., picklist values, config settings).
How to store & deploy technical reference data?
π¦ Use Custom Metadata Types (with records), deploy via Metadata API or Change Sets.
What are key considerations for reference data?
βοΈ Maintain a single source of truth, version control metadata, watch out for circular relationships, and respect governor limits in Apex queries.
What tool is used to load large volumes of reference data?
πΎ Data Loader β can import/export bulk data for Salesforce objects used as reference data.
π¦ Data Migration Order
What is the correct order to migrate core sales data?
π Accounts β Contacts β Leads β Products β Opportunities β Opportunity Line Items