It’s Friday! – July 22

Permanent link to this article: https://www.dvlprlife.com/2022/07/its-friday-july-22/

Do Cops write tickets in AL?

The AL Language extension (the language for developing applications for Microsoft Dynamics 365 Business Central) contains four code analyzers for analysis of your code at build time.

The AppSourceCop analyzer enforces rules for extensions intended for listing in Microsoft AppSource. Whereas the CodeCop analyzer enforces AL Coding Guidelines and the UICop analyzer enforces rules for the Web Client. The PerTenantExtensionCop analyzer enforces individual tenant rules.

The al.enableCodeAnalysis setting is used to set the state of code analysis and the al.codeanalyzers setting specifies which of the code analyzers to enable.


Note: as with most settings, the al.enableCodeAnalysis and al.codeanalyzers settings may be set for a project, workspace, or development environment.

Once the code analysis is enabled and the code analyzers specified, the Rule Id and Title appear for each file,  in the Problems window of the VS Code editor for any code “violations.”

It is possible to override the behavior of the code analyzer for specific Ids via the use of Pragma and Rulesets; that is for another time.

Note: The code listed in this article is for informational and demonstration purposes only. 

Permanent link to this article: https://www.dvlprlife.com/2022/07/do-cops-write-tickets-in-al/

Make life easier with Visual Studio Code Snippets

Snippets in Visual Studio code are templates that make it easier to enter repeatable code patterns or blocks. They’re a helpful timesaver when developing applications. I have found significant time savings within Business Central with Snippets for page and table field templates.

Visual Studio Code has several built-in Snippets, extension publishers may include Snippets, and you can also define your own.
You can see a list of the snippets by the Insert Snipper command in the command palette or by typing one of the triggers for IntelliSense.

Snippets are in JSON, and you can define the Snippet scope as global or project. Each file can contain an unlimited number of snippets.

A Snippet is a named element containing a prefix, body, and description. The prefix of the Snippet defines the trigger words used to display the Snippet in IntelliSense. The body has the actual code for the Snippet, and the description includes the text shown in IntelliSense for the Snippet.

Within the body of the Snippet, you can define TabStops, where the editor cursor will move within a Snippet. You use $1, $2, etc., to specify the cursor location, with $0 being the last TabStop.

PlaceHolders are similar to TabStops, with the addition of a default value. The syntax for a placeholder is similar to the TabStop, with the addition of the default value ${1:Value}. PlaceHolders can be nested: {$1:Value1 ${2:Value2}}

Visual Studio Code contains a range of Variables for use within the body of the Snippet. There are editor Variables for inserting file information, date/time information, and some random values. One of my favorite variables is the Clipboard’s contents with the ${CLIPBOARD}, another is the currently selected text  ${TM_SELECTED_TEXT}.

You can create your Snippet by selecting – Configure User Snippets from the settings menu and selecting either New Global Snippet or a New Project Snippet from the Command Palette. Once you have a Snippet file, you can also edit that directly.

For more information visit Snippets in Visual Studio Code

Note: The code listed in this article is for informational and demonstration purposes only. 

Permanent link to this article: https://www.dvlprlife.com/2022/07/make-life-easier-with-visual-studio-code-snippets/

Business Central AL ModuleInfo

In the AL Language, the programming language behind Microsoft Dynamics 365 Business Central, the ModuleInfo Data Type provides information about an application. I have often used the ModuleInfo returned by the NavApp to check specific application version information.
The NavApp DataType includes information about a NavApp and has a few methods that retrieve a ModuleInfo for the Calling, Current or Specific application.

local procedure ModuleInfoDemo(ModuleInfoReqType: enum "DVLPR ModuleInfo ReqType");
    var
        ModuleInfo: ModuleInfo;
    begin
        case ModuleInfoReqType of
            "DVLPR ModuleInfo ReqType"::Calling:
                NavApp.GetCallerModuleInfo(ModuleInfo);
            "DVLPR ModuleInfo ReqType"::Current:
                NavApp.GetCurrentModuleInfo(ModuleInfo);
            "DVLPR ModuleInfo ReqType"::Specific:
                NavApp.GetModuleInfo('{c512d720-63b9-4b26-b062-a0c09b4ed322}', ModuleInfo);
        end;

        PopulatePageFields(ModuleInfo);
    end;

    local procedure PopulatePageFields(ModuleInfo: ModuleInfo)
    var
        i: Integer;
        ModuleDependencyInfo: ModuleDependencyInfo;
        DependencyNames: Text;
        AppVersion,
        DataVersion : Version;

    begin
        AppVersion := ModuleInfo.AppVersion;
        DataVersion := ModuleInfo.DataVersion;
        Clear(DependencyNames);

        ModuleID := Format(ModuleInfo.Id);
        ModuleName := ModuleInfo.Name;
        ModulePublisher := ModuleInfo.Publisher;
        ModuleAppVersion := Format(AppVersion);
        ModuleDataVersion := Format(DataVersion);
        ModulePackageId := Format(ModuleInfo.PackageId);

        for i := 1 to ModuleInfo.Dependencies().Count() do begin
            ModuleInfo.Dependencies.Get(i, ModuleDependencyInfo);
            DependencyNames += ModuleDependencyInfo.Name + ',';
        end;

        ModuleDependency := DependencyNames;
    end;

For more information, see ModuleInfo Data Type and NavApp Data Type 

Note: The code listed in this article is for informational and demonstration purposes only. This content was created referencing Microsoft Dynamics 365 Business Central 2022 Wave 1

Permanent link to this article: https://www.dvlprlife.com/2022/07/business-central-al-moduleinfo/

It’s Friday! – July 15

Permanent link to this article: https://www.dvlprlife.com/2022/07/its-friday-july-15/

My First Homegrown Vegetable

My first homegrown vegetable and the best pepper that I have eaten!

Permanent link to this article: https://www.dvlprlife.com/2022/07/my-first-homegrown-vegetable/

View the Microsoft Dynamics 365 Business Central Tablet or Phone Client in a Browser

Microsoft Dynamics 365 Business Central allows users to access their data from a browser, tablet, or phone. The phone and tablet client provides users the flexibility to perform tasks while away from the browser.

Microsoft Dynamics 365 Business Central Phone ClientThere are several user experience differences between the different clients; The web client is intended for full application use, whereas the tablet and phone client are touch-optimized with the layout designed for the smaller screens.

In a mobile world, when developing a solution, it is crucial to consider the user experience with your Microsoft Dynamics 365 Business Central application on mobile devices. It is possible to open the tablet or phone client from a browser to make it easier to test a solution and consider the users’ experience. Depending on your application’s use and user experience, you may want a separate Role Center for mobile clients with pages with a carefully selected list of actions and fields.

To open the Microsoft Dynamics 365 Business Central tablet or phone client in a browser, append either “tablet” or “phone” after the instance of your Business Central installation.
For example:

Web Client: 
	http://bc20/BC/?tenant=default
	http://bc20/BC/?tenant=default&page=22

Tablet:
	 http://bc20/BC/tablet/?tenant=default
	http://bc20/BC/tablet/?tenant=default&page=22
Phone:
	http://bc20/BC/phone/?tenant=default
	http://bc20/BC/phone/?tenant=default&page=22

You can open the mobile client for a specific page, tenant, profile, company, report, or web client address by including the “tablet” or “phone” designator in the address after the instance name.

For more information, see the differences between the Business Central Mobile Apps.

Note: Information in this article is for informational and demonstration purposes only. This content was created referencing Microsoft Dynamics 365 Business Central 2022 Wave 1 

Permanent link to this article: https://www.dvlprlife.com/2022/07/view-the-microsoft-dynamics-365-business-central-tablet-or-phone-client-in-a-browser/

July 2022 Cumulative Updates for Dynamics 365 Business Central and Microsoft Dynamics NAV

The July updates for Microsoft Dynamics NAV and Microsoft Dynamics 365 Business Central are now available.

Before applying the updates, you should confirm that your implementation is ready for the upgrade and ensure compatibility with your modifications. Work with a Microsoft Partner to determine if you are ready and what is needed for you to apply the update.

Please note that SaaS customers will automatically be upgraded to 20.3 over the coming days/weeks and should receive an email notification when upgraded.

Direct links to the cumulative updates are listed here:

Dynamics 365 Business Central On-Premises 2022 Release Wave 1 Updates – Update 20.3 (July 2022)

Dynamics 365 Business Central On-Premises 2021 Release Wave 2 Updates – Update 19.9 (July 2022)

Dynamics 365 Business Central On-Premises 2021 Release Wave 1 Updates – Update 18.15 (July 2022)

Dynamics 365 Business Central On-Premises 2020 Release Wave 2 Updates – Update 17.17 (April 2022)

Dynamics 365 Business Central On-Premises 2020 Release Wave 1 Updates – Update 16.17 (October 2021)

Dynamics 365 Business Central On-Premises 2019 Release Wave 2 Updates – Update 15.17 (April 2021)

Dynamics 365 Business Central On-Premises Spring 2019 Updates – Update 37 (July 2022)

Dynamics 365 Business Central On-Premises October’18 Updates – Update 18 (April 2020)

Microsoft Dynamics NAV 2018 – Update 54 (July 2022)

Microsoft Dynamics NAV 2017 – Update Update 61 (January 2022)

Microsoft Dynamics NAV 2016 – Update 67 (July 2021)

Permanent link to this article: https://www.dvlprlife.com/2022/07/july-2022-cumulative-updates-for-dynamics-365-business-central-and-microsoft-dynamics-nav/

Dynamics 365 Business Central: Setting the Report Layout for a Report

Microsoft Dynamics 365 Business Central supports the definition of multiple report layouts for a report. Layouts are defined as part of the Report, a Report Extension, or a Custom Report Layout.

Within Microsoft Dynamics 365 Business Central, there are two ways to set the Layout that is used by a report. The Report Layout is set using the Report Layout Selection or Report Layouts pages.

Report Layouts Page

  • Search for the Report Layouts and open the Report Layouts Page
  • Find and select the Report Layout in the list
  • Click the Set Default action at the top of the page.

    Report Layouts Page

Report Layout Selection Page

  • Search for the Report Layout Selection and open the Report Layout Selection Page
  • Set the Company value for the company that includes the Report
  • Find the Report in the list
    • If the Layout is a different type than the current Layout, select the Layout Type field, then choose the type of the Layout you want to set
  • Select Layout action from the Navigation pane
  • In the Report Layouts page, select the Layout, then select OK.

    Report Layout Selection

Note: Report Layouts are defined on a per-company basis; therefore, the same Report can be used in a tenant with different layouts defined for each company. This content was created referencing Microsoft Dynamics 365 Business Central 2022 Wave 1 

Permanent link to this article: https://www.dvlprlife.com/2022/07/setting-the-report-layout-for-a-report/

Classic Code Monkey

It’s fitting at times to resurrect the classics!

Code Monkey – Jonathan Coulton

Permanent link to this article: https://www.dvlprlife.com/2022/07/classic-code-monkey/