@forcedotcom/switching-org

Switches the active Salesforce org (default target-org) using the Salesforce CLI. Use whenever someone wants to change which org CLI commands run against — whether they say \"switch org\", \"change default org\", \"set my org to\", \"use alias\", \"point to\", or describe wanting to work against a specific org, scratch org, sandbox, or production.

View in AI SkillSafe app
Scanned · no findings
1 downloads
0 stars
0 demos
SKILL.md
nameswitching-org
descriptionSwitches the active Salesforce org (default target-org) using the Salesforce CLI. Use whenever someone wants to change which org CLI commands run against — whether they say \"switch org\", \"change default org\", \"set my org to\", \"use alias\", \"point to\", or describe wanting to work against a specific org, scratch org, sandbox, or production.
compatibilitySalesforce CLI (sf) v2+

Steps

  1. Identify the org: the user provides a username or alias (orgIdentifier). If not provided, run sf org list to show authenticated orgs and ask the user which one to use.
  2. Set the default org:
    • Local (default): sf config set target-org <orgIdentifier>
      • Applies only within the current project directory. Use this for normal project work.
    • Global (only if user explicitly requests): sf config set target-org <orgIdentifier> --global
      • Applies system-wide across all directories. Use when working outside a project or when the user asks for global scope.
    • If this fails, report the error and suggest running sf org login web if the org may not be authorized.
  3. Verify:
    • sf config get target-org --json
    • Note: the JSON output does not include a scope/location field — it cannot confirm whether the value is local or global. Confirm the value only, e.g.: target-org is now set to: <value>
    • If it fails, report the error and advise running sf config get target-org.

Notes

Embed badges

Add these to your README to show the skill's verification status.

SkillSafe verified badge
Verified badge
[![SkillSafe verified badge](https://api.skillsafe.ai/v1/badge/@forcedotcom/switching-org/verified)](https://skillsafe.ai/skill/@forcedotcom/switching-org/)
Installs badge
Installs badge
[![Installs badge](https://api.skillsafe.ai/v1/badge/@forcedotcom/switching-org/installs)](https://skillsafe.ai/skill/@forcedotcom/switching-org/)
Scan badge
Scan badge
[![Scan badge](https://api.skillsafe.ai/v1/badge/@forcedotcom/switching-org/scan)](https://skillsafe.ai/skill/@forcedotcom/switching-org/)
Eval pass rate badge
Eval pass rate
[![Eval pass rate badge](https://api.skillsafe.ai/v1/badge/@forcedotcom/switching-org/eval)](https://skillsafe.ai/skill/@forcedotcom/switching-org/)