Currently, the Salesforce VS Code extension always retrieves metadata using the latest API version. This becomes problematic when working with multiple orgs (e.g., sandbox vs. production) that run on different API versions.
For example:
- Retrieve a Flow from a sandbox (API v63)
- Deploy to production (API v59)
- Flow contains unsupported elements, causing deployment failures
- Manual XML editing is required to remove incompatible components
Request:
Add a configurable setting in VS Code (either user/workspace settings or per-project sfdx-project.json) to specify the API version used when retrieving metadata via the Package.xml or right-click "Retrieve Source from Org."
Why This Matters:
- Prevents metadata compatibility issues between orgs
- Avoids manual cleanup of unsupported elements (e.g., Flow XML)
- Matches DX best practices (retrieve in the target org’s API version)
Repro Steps:
- Use SFDX: Retrieve Source from Org on a Flow in a sandbox (latest API).
- Attempt to deploy to an older-version production org.
- Deployment fails due to unsupported Flow features.
Expected Behavior:
- A setting (e.g., "salesforcedx-vscode-core.retrieve-api-version": "59.0") forces metadata retrieval in the specified API version.
Workaround:
- Manually edit XML files (e.g., Flow definitions) to remove unsupported elements.
- Use CLI with sfdx force:mdapi:retrieve -k package.xml -u myOrg -a 59.0 (but this bypasses VS Code).
Additional Context:
- Critical for Flow deployments where newer API elements break older orgs.
- Similar to how sfdx-project.json can define sourceApiVersion, but retrieval should respect it.
Why This Is Better for the Salesforce Extension
- Explicitly mentions VS Code/SFDX Extension (not just generic GitHub issue).
- References Package.xml and Retrieve Source from Org (core extension features).
- Suggests a practical setting name (salesforcedx-vscode-core.retrieve-api-version).
- Compares with existing CLI behavior (force:mdapi:retrieve -a).
Currently, the Salesforce VS Code extension always retrieves metadata using the latest API version. This becomes problematic when working with multiple orgs (e.g., sandbox vs. production) that run on different API versions.
For example:
Request:
Add a configurable setting in VS Code (either user/workspace settings or per-project sfdx-project.json) to specify the API version used when retrieving metadata via the Package.xml or right-click "Retrieve Source from Org."
Why This Matters:
Repro Steps:
Expected Behavior:
Workaround:
Additional Context:
Why This Is Better for the Salesforce Extension