A Step-by-Step Guide to Connecting Visual Studio Code with Your Business Central Sandbox
- Josh
- Sep 23
- 3 min read
Connecting Visual Studio Code (VS Code) to your Business Central Sandbox. This guide will help you set up this connection, making your development process more efficient from the start.
Understanding Business Central and Visual Studio Code
Microsoft Dynamics 365 Business Central is a cloud-based solution that helps businesses manage a variety of processes, including finance, sales, and customer service. It’s designed to bring all these functions together, providing valuable insights and control.
By connecting VS Code to your Business Central Sandbox, you tap into a seamless coding environment that enhances productivity, reduces bugs, and allows for real-time updates.
Prerequisites
Before you start, be sure you have these items ready:
Business Central Sandbox: Ensure you have access to a Business Central Sandbox. If not, create one through the Business Central admin center.
Visual Studio Code: Download and install the latest version from the Visual Studio Code website.
AL Language Extension: Install the AL Language extension in Visual Studio Code for Business Central development. This extension is vital for syntax highlighting and code snippets that improve coding accuracy.
Microsoft Dynamics 365 Business Central Development Environment: Make sure you have permissions to access it.
AL Development Tools: Familiarize yourself with the components and settings of the AL development tools.
Step 1: Install the AL Language Extension
Installing the AL Language extension is your first task. Follow these straightforward steps:
Open Visual Studio Code.
Click on the Extensions icon in the Activity Bar or press `Ctrl+Shift+X`.
In the search bar, type "AL Language" and hit Enter.
Click "Install" next to the AL Language extension.
With the AL Language extension, you gain syntax highlighting and tailored code suggestions essential for Business Central development, making your code easier to write and read.
Step 2: Create a New AL Project
Creating an AL project is your next objective. Here’s how to do it:
Open Visual Studio Code.
Press `Ctrl+Shift+P` to bring up the Command Palette.
Type "AL: Go!" and select it.
Choose a folder for your new project.
Enter a name for your project and hit Enter.
Select the Business Central version you are targeting.
This setup process generates all necessary files and folders for your project, ready for coding.
Step 3: Configure the Launch.json File
Next, you’ll need to configure the `launch.json` file to connect with your Business Central Sandbox:
Locate the `.vscode` folder in your project folder.
Open the `launch.json` file.
Update the configuration settings to match your Business Central details. Here's an example configuration:
"configurations": [
    {
      "name": "Development",
      "request": "launch",
      "type": "al",
      "server": "https://businesscentral.dynamics.com/",
      "tenant": "Your BC Guid",
      "environmentType": "Sandbox",
      "environmentName": "Development",
      "startupObjectId": 22,
      "startupObjectType": "Page",
      "breakOnError": "All",
      "launchBrowser": true,
      "enableLongRunningSqlStatements": true,
      "enableSqlInformationDebugger": true
    }
```
Be sure to replace `Your BC Guid` with the correct guid for your Business Central Sandbox. This can be found in the URL to your business central environment.
Step 4: Download Symbols from your Business Central Sandbox
Having configured the `launch.json` file, you can now connect to your Business Central Sandbox:
Open the Command Palette by pressing `Ctrl+Shift+P`.
Type "AL: Download symbols" and select it.
You will see a confirmation that you have successfully connected to your Business Central sandbox
Step 5: Deploying Your Code
Deployment is straightforward once your code is ready:
Open the Command Palette by pressing `Ctrl+Shift+P`.
Type "AL: Publish" and select it.
You will see a confirmation that your code has been published to the Business Central Sandbox.
This step ensures your changes are immediately live in your testing environment.
