Category: App Development

How to Create Assisted Setup -Business Central

As you aware that with new version of business central comes up breaking changes which actually change the way of writing few points like assisted setup and many more.

Today we will see how to create assisted setup in wave 2 with new events. In this document have created one of the most simple assisted setup.

Step 1 :- Create New table

table 50100 "SetupTable"
{
    DataClassification = CustomerContent;

    fields
    {
        field(1; GroupCode; Code[10])
        {
            DataClassification = CustomerContent;

        }
        Field(2; "Group Description"; text[100])
        {
            DataClassification = CustomerContent;
        }
    }

    keys
    {
        key(PK1; GroupCode)
        {
            Clustered = true;
        }
    }



}

2. Create New page

page 50100 "SetupPage"
{
    PageType = ListPart;
    SourceTable = SetupTable;
    layout
    {
        area(content)
        {
            repeater(SetupGroup)
            {
                field(GroupCode; GroupCode)
                {
                    ApplicationArea = All;
                    ToolTip = 'Select the specified group code';
                }
                field("Group Description"; "Group Description")
                {
                    ApplicationArea = All;
                    ToolTip = 'Specifies a description.';
                }
            }
        }
    }
}

Step 3 :- Now use new assisted setup module to create assisted setup as below

codeunit 50100 "SetupTableAssistedSetup"
{

    var
        AssistedSetup: Codeunit "Assisted Setup";
        AssistedSetupGroup: Enum "Assisted Setup Group";
        CurrentGlobalLanguage: Integer;
        SetupWizardTxt: Label 'Set up Table';
        SetupWizardLinkTxt: Label 'https://google.com', Locked = true;

        AlreadySetUpQst: Label 'Setup is already set up. To change settings for it, go to the setup again.Do you want go there now ?';

    [EventSubscriber(ObjectType::Codeunit, Codeunit::"Assisted Setup", 'OnRegister', '', false, false)]
    local procedure SetupInitialize()

    begin
        CurrentGlobalLanguage := GlobalLanguage();
        AssistedSetup.Add(GetAppId(), PAGE::SetupPage, SetupWizardTxt, AssistedSetupGroup::Extensions, '', SetupWizardLinkTxt);
        GLOBALLANGUAGE(1033);
        AssistedSetup.AddTranslation(GetAppId(), PAGE::SetupPage, 1033, SetupWizardTxt);
        GLOBALLANGUAGE(CurrentGlobalLanguage);
        GetInformationSetupStatus();
    end;

    [EventSubscriber(ObjectType::Codeunit, Codeunit::"Assisted Setup", 'OnReRunOfCompletedSetup', '', false, false)]
    local procedure OnReRunOfCompletedSetup(ExtensionId: Guid; PageID: Integer; var Handled: Boolean)
    begin
        if ExtensionId <> GetAppId() then
            exit;
        case PageID of
            Page::"Assisted Company Setup Wizard":
                begin
                    if Confirm(AlreadySetUpQst, true) then
                        Page.Run(PAGE::SetupPage);
                    Handled := true;
                end;
        end;
    end;

    local procedure GetAppId(): Guid
    var
        Info: ModuleInfo;
        EmptyGuid: Guid;
    begin
        if Info.Id() = EmptyGuid then
            NavApp.GetCurrentModuleInfo(Info);
        exit(Info.Id());
    end;


    local procedure GetInformationSetupStatus()
    var
        SetupTab: Record SetupTable;
    begin
        SetupTab.SetFilter(GroupCode, '<>%1', '');
        If SetupTab.IsEmpty() then
            exit;
        AssistedSetup.Complete(GetAppId(), Page::SetupPage);

    end;
}




Publish the extension and you will see following result.

Hope this will help you….

Business Central :How to Customize Base App

This blog explains how to customize the base app of business central (old fashion) .

Please Don’t customize the base app, Use extension wherever possible

Step 1 :- Copy Base Application from installer

Step 2 :- Unzip in designated folder .This contains app.json file where in target set to onprem

app.json will look like this

Step 3 :- Download the symbols

Step 4:- Add the following in either user settings/workspace settings . This is required for .NET DLL used in application

Step 5 :- Unpublish the base application and dependencies or else you will get an error stating that extension already deployed on tenant

Use following PowerShell command

Unpublish-NavApp -Name “Base Application” -ServerInstance BC150

Step 6:- Import license file and publish the modified app.

Hope this will help you.

Keyboard Shortcut :- Business Central & VS Code

For my previous contribution on business central please visit this link

This blog contains keyboard shortcut for business central and VS code while will make our life easier while navigating and developing business central extension aka app.

Hope this will help you…

Cumulative Update Summary October 2019

This image has an empty alt attribute; its file name is updateimage.jpg

Cumulative Update includes all application and platform hotfixes and regulatory features that have been released for Microsoft Dynamics NAV.

Microsoft Business Central Spring CU 2:- BUSINESS CENTRAL CU 2

Microsoft Dynamics NAV 2018 CU 22 :- NAV2018CU22

Microsoft Dynamics NAV 2017 CU 35 :- NAV 2017 CU34

Microsoft Dynamics NAV 2016 CU 48 :- NAV 2016 CU 47

Microsoft Dynamics NAV 2015 CU 60 :-NAV 2015 CU 60

Warning

Before you install a cumulative update in a production environment, take the following precautions:

  1. Test the cumulative update in a non-production environment.
  2. Make a backup of the system or computer where the cumulative update is to be installed.

Stay tuned for more updates…

Business Central Wave 2-Upload License

With the release of business central wave 2 No Developer environment ,so question comes how to upload customer/developer license in database.

Powershell command comes to rescue in this environment. Following few commands will help you to upload the license.

Step 1 :- Open windows PowerShell ISE as Administrator

Step 2:- Import Module for Business Central Wave 2 .Use following command

Import-Module 'C:\Program Files\Microsoft Dynamics 365 Business Central\150\Service\NavAdminTool.ps1'

Step 3 :- Add following command to import the license

Import-NAVServerLicense -LicenseFile 'C:\Cronus.flf' -ServerInstance BC150

Step 4 :- Restart Service

Restart-NAVServerInstance -ServerInstance BC150

Step 5 :- See the information of License

Export-NAVServerLicenseInformation -ServerInstance BC150

Hope this will help you. Explore more..

*** Change path of license file and Service name according to your configuration

Business Central Wave 2 -Upcoming Features

As you all aware that business central Wave 2 all set to release in month of October and we just go preview

Below file is list of all upcoming features planned in wave 2 of business central

Hope this will help you..

CU02 for Business Central Spring Release 2019

Cumulative Update includes all application and platform hotfixes and regulatory features that have been released for Microsoft Dynamics NAV.

Microsoft Dynamics Business Central Spring Release CU 01 :- BCCU02

Warning

Before you install a cumulative update in a production environment, take the following precautions:

  1. Test the cumulative update in a non-production environment.
  2. Make a backup of the system or computer where the cumulative update is to be installed.

Stay tuned for more updates…

Business Central-Field Length change in Tables

This spring release of business central comes up with changes in field length of tables as below.

You can check those tables and fields in following file

Hope this will help you specially while upgrade.

Please follow Waldo’s blog for more information on above subject.http://www.waldo.be/2019/05/14/microsoft-dynamics-365-business-central-spring-update-changed-some-field-lengths/

Stay tuned for more.

How to search Pages using Additional Search Terms in Business Central

All of you aware of ‘Tell Me‘ features of business central where you can search pages ,reports by key in name .

Today we will see how to search page apart from default page name .

To achieve this we need to add additional parameters in list pages as follows

Compile the object and search the page using additional terms in web client

Now from web client search the page using additional terms defined in list page

Hope this will help you

Stay tuned for more..

How to Create Unique Keys in AL Development/Business Central

Spring Release 2019 of business central comes up with new features for creating unique keys

Today we will see how to create unique keys in table

While creating second keys you can add an additional parameters said ‘Unique’. This will not allow duplicate values in the field where unique parameter is mentioned.

Now we will see this validation works on business central. Here we are trying put same description which is throwing error because of unique key.

You can define multiple unique keys in one table.

Points to Remember

  • Field can have empty value that means empty value is also value.
  • Not supported in table extensions.

Hope this will help you ..