Overview of Dynamics 365 Business Central October ’18 release

Original URL…

Improved Visual Studio Code AL experience

Be more productive when developing and troubleshooting extensions with new and improved developer tools, such as sandbox environments with production data, improved breakpoint support, better inline Help, ability to trace raised events in a given user scenario, support for .NET Interop for on-premises deployments, extension support for enums, report data set and field groups, and more.

Anuncios

A way to deal with Extension IDs in NAV (Business Central) AL

Original URL...

In AL VS Code Extensions V2, if you try to create an extension and the ID or Name are already used, you get this error:

Because we don’t have the extension id in the name of the file (I assume you don’t have it either), you can use the following Powershell script to check what files are using the same name for example (change according to your need):

1
2
3
4
$Folder = 'your folder\with extensions'
$SearchString = 'pageextension50545' #your search string
$File = (Get-ChildItem $Folder -Filter '*.al' |
Where-Object {Select-String $SearchString $_}).Name
$File

This code will search for the string in the first line of each file and show you what files contain the same Id/name:

! Ok, this was the easy part. Now I want to assign a different Id (the next free Id) for my current file, in order to fix the error. But which is the next ID ? In good old C/SIDE it was so easy to find out things like this…

In order to find out the next free Id in AL, I need to look in each file and compare all the Ids to see which one is the greatest. The problem is that by now I have 200-300 files, so it will probably take around one week to do this manually…

Not when we have Powershell 🙂

First let’s see the situation from my example (you can then adapt the script for your own situation):

–> I have 1 folder with 2 sub folders with AL Page Extension files:
* Files in folder 1 are named like this:

* Files in folder 2 are named like this:

* The first line of each file contains information about the page extension like this:
pageextension 50333 pageextension50333 extends “Bank Account Card”

So, let’s look automatically in each file at the first line, create an array with the IDs, Object Name that it extends and other useful information about the files:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
Function Get-ALExtensionFilesInfo{
    [CmdletBinding()]
    param(
        [Parameter(Mandatory=$true)][array]$ALExtensionFiles,
        [switch]$GetIDFromExtensionName,
        [switch]$GetObjectNameFromFileName
        )
    If($GetIDFromExtensionName) {
        #let's complicate things for practice with
regex and extract the ID from the extension
name instead of simply take the Id
        [regex]$Regex = '[a-zA-Z]+(?<num>\d+)'
    } else {
        [regex]$Regex = '(?<num>\b\d+)'
    }
    $ExtensionNumbers = @()
    foreach($File in $ALExtensionFiles)
    {
        $ExtHash = @{}
        $stringfirstline = (Select-String
-InputObject $file -Pattern $RegEx | select-object -First 1).Line
        $m = $Regex.Matches($stringfirstline)
        $number = ($m[0].Groups["num"].Value) * 1
        $ExtHash.Add("FileName",$File.FullName)
        If(!$GetObjectNameFromFileName) {
            #match the object name from the first line
(after word 'extends'):
            $ExtHash.Add("ObjectName",(([regex]::Match
($stringfirstline,'(?<=extends ).*').Value) -replace '"','').TrimEnd())
        } else {
            #OR match the object name from file name: ex Name of file is 'PEX50343 - Test.al' or 'PEX - Test.al'; Object Name is 'Test.al'
            $ExtHash.Add("ObjectName",[regex]::Match($File.Name,'(?<=PEX(?:\d+)? - ).*').Value)
        }
        
        $ExtHash.Add("ExtensionNumber",$number)
        $ExtHash.Add("ExtensionType",[regex]::Match($stringfirstline,'^\b\w+'))
        $PsObject = New-Object PSObject -property $ExtHash
        $ExtensionNumbers += $PsObject
    }
    return $ExtensionNumbers
}

Let’s see how to use this function:

1
2
3
4
5
6
7
8
$Folder = 'C:\ALExtensionIdsSample\Folder 1'
$Folder2 = 'C:\ALExtensionIdsSample\Folder 2'
$Files = Get-ChildItem $Folder -Filter '*.al'
$Files += Get-ChildItem $Folder2 -Filter '*.al'
#get the info from extension files
$ExtensionInfo = Get-ALExtensionFilesInfo -ALExtensionFiles $Files
$ExtensionInfo

–> And now we have an array with custom objects that we can use:

For example, to get the last used extension ID for page extensions:

1
2
3
4
5
6
#get the maximum used id for page extensions
$MaxMinNo = $ExtensionInfo |
            Where-Object{$_.ExtensionType -like 'pageextension'} |
            Measure-Object -Property ExtensionNumber -Maximum -Minimum
$ExtensionInfo | Where-Object {($_.ExtensionNumber -eq $MaxMinNo.Maximum) -and
                               ($_.ExtensionType -like 'pageextension')}

Output:

Or I know I have a page Extension for page “Tranfer Order” and I want to retrieve the Id:

1
2
$ExtensionInfo | Where-Object{($_.ObjectName -like 'Transfer Order') -and
                              ($_.ExtensionType -like 'pageextension')}

Output:

–> Or the opposite example when I have the Extension Id and I need to find out the Name of the Object that it extends:

1
2
3
$ExtensionInfo | Where-Object{($_.ExtensionNumber -eq 50292) -and
                              ($_.ExtensionType -like 'pageextension')} |
                 Select-Object -Property ObjectName

Output:

For this script I used some simple powershell commands and a little bit of Regex. This is not a final product, but more a script made quickly when I was in need 🙂

What do you say, would it be helpful a Powerhell module with functions for this kind of stuff ? Or maybe we should just wait for Microsoft to provide a better way of dealing with Extension Ids (or maybe they plan to not use Ids in the future) ?

You can find these scripts also on my GitHub:
https://github.com/andreilungu/Utilities/tree/master/Powershell
Filename: 001_GetALExtensionIDandObjectName.ps1

*Later Edit:
In the meantime I created a small Powershell module to help you get information about AL Extension Files. You can read

Getting Started with AL

Original URL…

To get started writing extensions for Dynamics 365 Business Central you will 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 will use for coding and debugging.

Steps to set up a sandbox environment and Visual Studio Code

Go through the following steps to set up a sandbox environment. With the preview you get sample code that compiles and runs with just a few commands.

  1. Sign up for a Dynamics 365 Business Central sandbox.
  2. Download Visual Studio Code.
  3. Download the AL Language extension.
  4. Press Ctrl+, to open the user settings window; here you can modify the telemetry settings.
  5. Press Alt+A, Alt+L to trigger the AL Go! command, and then choose Cloud.
  6. Enter the credentials you provided for the sign up, and then Download symbols.
  7. Press F5 to deploy and run the extension on your online sandbox tenant.

Note

Use Ctrl+Shift+P to clear the credentials cache if you want to deploy against a different environment.

You now have a HelloWorld sample that compiles and runs. The JSON files in the project are automatically updated with the settings that allows you to press F5 to build and deploy the solution.

Tip

For information about which sandboxes you can choose, see Choosing Your Dynamics 365 Business Central Development Sandbox Environment.

Note

Build and get inspired by our sample library on GitHub.

JSON file settings

There are two JSON files in the project; the app.json file and the launch.json file. The files are automatically generated for your project. For more information, see JSON files.

Telemetry settings

By default, Visual Studio Code is set up with a telemetry system to enable that data and errors are sent to Microsoft. If you do not want to send telemetry data, you can change the telemetry.enableTelemetry setting from true to false.

To modify the telemetry setting, press Ctrl+, in Visual Studio Code and choose the user settings window, which opens the settings.json file, and then add telemetry.enableTelemetry and set it to false.

"telemetry.enableTelemetry": false,

Tip

The settings.json file contains user and workspace settings, these options can be modified to suit your preference. If you want to modify Visual Studio Code editor options and functional behavior settings, see User and Workspace Settings.

The symbol file

The symbol file contains metadata of the application. This is what your extension is being built on, and therefore the symbol file must be present. If it is not present, you will be prompted to download it. For more information about the platform symbol file, see Symbols.

Installing and publishing an extension

To make your extension available to users, the package must be published to a specific Microsoft Dynamics 365 Business Central Server instance. The extension can be installed for one or more tenants. For more information about how to install and publish an extension, see How to: Publish and Install an Extension V2.

Mark Brummel Blog – Business Central-as-a-Framework

Original URL…

Compared to other programming languages AL can be less intuitive to get started with and it behaves unexpectedly for modern developers. It requires a lot of effort for the Business Central team to maintain a language dedicated for only one application.

Solution is to move AL to TypeScript to reduce the learning curve for new developers and add modern programming capabilities….

Dynamics 365 Documentation

Original URL…

    • Get started with Dynamics 365
      • What’s new

        Stay on top of the latest features and releases

      • FastTrack your deployment

        Speed up your rollout with personalized tools, resources, and best practices

      • Training classes

        Find the right eLearning courses for your role

      • Accessibility center

        Resources for people with disabilities

      • GDPR center

        Learn how Dynamics 365 supports your GDPR compliance journey

Development in AL

Original URL…

The AL developer environment is evolving with frequent updates. To stay up to date on the latest information and announcements, follow us on the Dynamics NAV Team Blog.

Development in AL

Extensions are a programming model where functionality is defined as an addition to existing objects and defines how they are different or modify the behavior of the solution. This section explains how you can develop extensions using the development environment for Dynamics 365 Business Central.

If you are new to building extensions, we recommend that you read this document to get an understanding of the basics and terms you will encounter while working. Next, follow the Getting Started with AL to set up the tools.

Tip

If you are looking for the C/SIDE documentation, visit our Dynamics NAV library.

Understanding objects in the development environment

All functionality in Dynamics 365 Business Central is coded in objects. The extension model is object-based; you create new objects, and extend existing objects depending on what you want your extension to do. Table objects define the table schema that holds data, page objects represent the pages seen in the user interface and codeunits contain code for logical calculations and for the application behavior. These objects are stored as code, known as AL code, and are saved in files with the .al file extension. The AL Language extension also supports the multi-root functionality which allows you to work with multiple AL folders within one workspace. For more information on how to group a set of disparate project folders into one workspace, see Working with multiple AL project folders within one workspace.

Note

A single .al file may contain multiple objects.

There are two other special objects which are specifically used for building extensions. Table extension objects and page extension objects are used for defining additive or overriding changes to table or page objects. For example, an extension for managing a business that sells organic food may define a table extension object for the Item table that contains two additional fields, Organic and Produced Locally. The Organic and Produced Locally fields are not usually present in the Item table, but through the table extension these data fields will now be available to store data in and to access from code. You can then use the page extension object to display the fields that you added to the table object.

Note

Extension objects can have a name with a maximum length of 30 characters.

You have several options for creating new objects with the AL Language extension for Visual Studio Code. For more information about the objects that you can create for your extension, see AL Development Environment.

Developing extensions in Visual Studio Code

Using the AL Language extension for Visual Studio Code, you will get the benefits of a modern development environment along with seamless publishing and execution integration with your Dynamics 365 Business Central tenant. For more information on getting up and running, see Getting Started with AL.

Visual Studio Code and the AL Language extension lets you do the following tasks:

  • Create new files for your solution
  • Get assistance with creating the appropriate configuration and setting files
  • Use code snippets that provide templates for coding application objects
  • Get compiler validation while coding
  • Press F5 to publish your changes and see your code running

For more information, see Visual Studio Code Docs.

Tip

If you have previous experience working with the C/SIDE development environment and need an overview of some of the changes between the two development environments, see Differences in the Development Environments.

Designer

The Designer works in the client itself allowing design of pages using a drag-and-drop interface. The Designer allows building extensions in the client itself by rearranging fields, adding fields, and previewing the page design. For more information, see Using Designer.

Compiling and deploying

Extensions are compiled as .app package files. The .app package file can be deployed to the Dynamics 365 Business Central server. An .app package contains the various artifacts that deliver the new functionality to the Dynamics 365 Business Central deployment as well as a manifest that specifies the name, publisher, version, and other attributes of the extension. For information about the manifest, see JSON Files.

Submitting your app

When all development and testing is done, you can submit your extension package to AppSource. Before you submit the extension package, we encourage you to read the checklist to help facilitating the validation. For more information, see Checklist for Submitting Your App.

See Also

Getting Started with AL
Keyboard Shortcuts
AL Development Environment
FAQ for Developing in AL

How to configure Visual Studio Code(VS Code) for Extensions in Microsoft Dynamics NAV 2018

Original URL…

Developer Preview – March Update

Original URL…

We’re pleased to announce the March update of the Developer Preview. We have been working hard on improving the capabilities of the toolset as well as fixing incoming issues reported by you. Below you can see the changes that we’re announcing for this update. The preview is already available if you sign up for the Ready to Go program. Read more at http://aka.ms/readytogo.

After April 2nd the build will become public and you can get it through http://aka.ms/bcsandbox.

Please note, that the improvements announced in this blog post are not available in Dynamics NAV 2018 and the following cumulative updates of Dynamics NAV 2018.

 

Static Code Analysis

Specifying “al.enableCodeAnalysis”: true in your settings will enable static code analysis for AL projects.  Three analyzers have been implemented that will support general AL coding guidelines, AppSource, and per-tenant extension analysis. Analyzers can be individually enabled by specifiying them in the al.codeAnalyzers setting.

“al.enableCodeAnalysis”: true,

“al.codeAnalyzers”: [

“${CodeCop}”

]

You can customize how the diagnostics generated by the analyzers are reported by adding a custom ruleset file <myruleset>.ruleset.json to the project and specifying the path to it in the “al.ruleSetPath” setting.

“al.ruleSetPath” : “myruleset.ruleset.json”

Using the snippets truleset and trule will get you started quickly.

For more information, see Using the Code Analysis Tool.

Help for new pages

When creating new Pages, Reports, and XMLPorts in Extensions V2, it is now possible to specify the help link that will be used when the user presses the Help button in the user interface.

You can do this by using the property HelpLink on Pages, for example:

page 50100 MyPageWithHelp
{
HelpLink = ‘https://www.github.com/Microsoft/AL&#8217;;
}

And by using the property HelpLink on the request page of Reports and XmlPorts:

report 50100 MyReportWithHelp
{
requestpage
{
HelpLink = ‘https://www.github.com/Microsoft/AL&#8217;;
}
}

For more information, see Adding Help Links.

Creating Role Center Headlines

You can set up a Role Center to display a series of headlines, where headlines appear one at a time for a predefined period of time before moving to the next. The headlines can provide users with up-to-date information and insights into the business and their daily work.
For more information, see Creating Role Center Headlines.

 

Improved experience for event subscribers

We improved the snippets and IntelliSense around event subscribers, for both the attribute arguments and the method parameters. This is now working for trigger events, integration and business events. In case of business and integration events, the suggestion of the method parameters is made based on the attributes of the event publisher in order to know if the global variables and/or the sender should also be suggested.

Here is what it looks like to subscribe to an integration event when using the snippets:

Here is what it looks when writing the event subscriber from scratch:

 

Working with data?

You can now inspect the contents of a table when you publish an AL project (F5 and Crtl+F5) from Visual Code. Simply modify the launch.json file of the project to include the “startupObjectType=”table” and “startupObjectId”=” settings, replacing with the ID of the table that you want to see. The table will display in client as read-only.

From the client, you can also view a specific table by appending the URL with “&table=”, such as:
https://businesscentral.dynamics.com/?company=CRONUS%20Inc.&table=18

For more information, see Viewing Table Data.

 

Choose your cue layout on Role Centers

We now offer a wide layout option for cues. The wide layout is designed to display large values and gives you a way emphasize a group of cues. When set to the wide layout, a cue group will be placed in its own area, spanning the entire width of the workspace.

For more information, see Cues and Action Tiles.

 

As usual we encourage you to let us know how you like working with these additions and keep submitting suggestions and bugs. You can see all the filed bugs on our GitHub issues list (https://github.com/Microsoft/AL/issues).

 

For a list of our previous blog posts, see the links at the end of this post.

NAV Development Tools Preview – February 2018 Update

NAV Development Tools Preview – Anniversary Update

NAV Development Tools Preview – December 2017 Update

NAV Development Tools Preview – November 2017 Update

NAV Development Tools Preview – October 2017 Update

NAV Development Tools Preview – September 2017 Update

NAV Development Tools Preview – August 2017 Update

NAV Development Tools Preview – July 2017 Update

NAV Development Tools Preview – June 2017  Update

NAV Development Tools Preview – April 2017 Update

NAV Development Tools Preview – March 2017 Update

NAV Development Tools Preview – February 2017 Update

NAV Development Tools Preview – January 2017 Update

Announcing the Preview of Modern Development Tools for Dynamics NAV

Programming in AL

AL is the programming language that is used for manipulating data (such as retrieving, inserting and modifying records) in a Dynamics 365 for Finance and Operations, Business edition and Dynamics NAV database, and controlling the execution of the various application objects, such as pages, reports, or codeunits. More…

Converting Dynamics NAV source code from C/AL to AL using PowerShell

Original URL…

Converting from C/AL to AL can be a bit of a hassle:

  • First you need to open den Development Environment
  • Then filter the objects that needs converting
  • Export the objects to a txt file in a folder
  • Then Run the Txt2AL.exe
  • Lastly import them in the workspace

The Script can be downloaded here:

http://ba-consult.dk/downloads/Convert_CAL_AL.zip