Skip to content

[Feature Request] Allow setting API version for metadata retrieval in Package.xml #145

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Abhishekrazy opened this issue Apr 8, 2025 · 0 comments

Comments

@Abhishekrazy
Copy link

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).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant