Deploy a Flow from VS Code
You clicked Copy Flow XML in the Config Library — here's how to get that flow into your Salesforce org with VS Code and the Salesforce CLI. This is the developer path; if you'd rather not touch a code editor, build the flow by hand with the Flow Cheat Sheet or use the in-app Setup Wizard.
1. What you need
Three free tools — install once and you're set for every future deploy:
- Visual Studio Code — the code editor.
- Salesforce Extension Pack — adds the SFDX commands to VS Code. Install it from the Extensions panel (search "Salesforce Extension Pack").
- Salesforce CLI (
sf) — the command-line tool the deploy runs through. Confirm it's installed by runningsf versionin VS Code's terminal.
2. One-time setup
Skip this section if you already work in an SFDX project connected to your org.
A Authorize your org
Connect VS Code to your Salesforce org. Open the Command Palette (Ctrl/Cmd + Shift + P) and run SFDX: Authorize an Org — or from the terminal:
sf org login web --alias myorg
A browser opens; log in and approve. Use a sandbox or Developer org first, not production.
B Open or create a project
If you have an SFDX project, open its folder in VS Code (File → Open Folder). If not, create one:
sf project generate --name multidatepick-flows
cd multidatepick-flows
Then open that folder in VS Code. You should see a force-app/main/default/ structure in the Explorer panel.
3. Import the copied XML
1 Create the flow file
In the Explorer, expand force-app/main/default/ and open (or create) the flows folder. Add a new file named after your config, ending in .flow-meta.xml — for example On_Call_Rotation.flow-meta.xml. The name becomes the flow's API name, so use letters, numbers, and underscores only.
Or create it straight from VS Code's integrated terminal:
# Windows (PowerShell)
New-Item force-app/main/default/flows/On_Call_Rotation.flow-meta.xml -ItemType File -Force
# macOS / Linux
mkdir -p force-app/main/default/flows && touch force-app/main/default/flows/On_Call_Rotation.flow-meta.xml
2 Paste and save
Paste the XML you copied from the Config Library into the new file and save (Ctrl/Cmd + S).
3 Deploy to your org
Right-click the file in the Explorer and choose SFDX: Deploy Source to Org — or run this in the terminal:
sf project deploy start --source-dir force-app/main/default/flows/On_Call_Rotation.flow-meta.xml
Watch the Output panel for Deploy Succeeded. If it reports a field or object error, that's expected — the next step fixes it.
4. Finish in Flow Builder
4 Swap in your object and field names
In your org, go to Setup → Flows and open the flow you just deployed. Look for the elements and notes marked >>> UPDATE — those point at the object and field API names the sample assumed. Change each one to match your own object, date field, and lookup. Then Save and Activate.
That's it — drop the flow on a page, a button, or run it directly, and members can start selecting dates.
sf org login web --alias myorg # authorize once
sf project generate --name multidatepick-flows # only if you need a new project
sf project deploy start --source-dir force-app/main/default/flows/YOUR_FLOW.flow-meta.xml
Stuck on the CLI? Salesforce's CLI setup guide covers install and login in detail.