Exercise - Set up the development environment

Completed

Scenario

To get started writing extensions for Business Central, you'll need a Dynamics 365 Business Central tenant, Visual Studio Code, and the AL Language extension. Visual Studio Code is a cross-platform editor that you'll use for coding and debugging.

Set up a sandbox environment

To set up a sandbox environment, follow these steps:

  1. Sign up for a Dynamics 365 Business Central sandbox.

  2. Follow the registration process and wait until the Business Central environment is ready.

  3. Open the Admin Center, by choosing the Admin Center link in the Settings menu when you're signed into Business Central.

  4. On the Environments tab of the Business Central administration center, choose the New action on the action ribbon.

  5. In the Create Environment pane, Specify a name for the new environment, for example Sandbox.

  6. In the Environment Type list, choose Sandbox.

  7. In the Country list, select the country for the environment. The specified country determines the localization for the environment and the Azure region in which the environment is created and stored.

  8. In the Version list, specify the relevant application version for the new environment if more than one version is available.

  9. Choose the Create action.

  10. The new environment won't be accessible until the State shows Active.

  11. When the new Sandbox environment is ready, open it.

To set up the development environment, follow these steps:

  1. Download Visual Studio Code.

  2. Download the AL Language extension.

To create a new app, follow these steps:

  1. Press the Alt+A, Alt+L shortcut keys to trigger the AL Go! command, and then choose a path to a new empty folder and the version to run.

  2. Use CustomerRewards as the name of the project

  3. Select Microsoft cloud sandbox as the server.

  4. Enter the credentials that you provided during signup.

  5. The system now downloads symbols.

    If there are any errors, then update your launch.json file and make sure the EnvironmentName parameter exactly matches the name of your sandbox and then download symbols again.

    • In an AL project there are two JSON files; the app.json file and the launch.json file that are generated automatically when you start a new project. The app.json file contains information about the extension that you're building, such as publisher information and specifies the minimum version of base application objects that the extension is built on. Often the app.json file is referred to as the manifest. The launch.json file contains information about the server that the extension launches on.
  6. Press the F5 or Ctrl+F5 key to deploy and run the extension on your online sandbox tenant.

You now have a HelloWorld sample that compiles and runs.

In an extension, the .al files should be stored in a folder, named src. Therefore we'll first remove the HelloWorld.al file and create the src folder.

To prepare the folders, follow these steps:

  1. Delete the HelloWorld.al file

  2. Create a new folder named: src