Category Archives: New Development Tool

Business Central :Code Unit 1 Retired

 

15Though we are eagerly waiting for October 2018 Business central on-premise version and meanwhile we have news that Codeunit 1 (Application Management ) has been retired and new system events has been introduced in 2 billion range.

This has been refactor to cope up with new development environment .so  henceforth you will not find Codeunit 1 in object designer.

Whenever database is created these special codeunits will be created automatically. As well as they will not contain event instead of code.

Following functions become events

 

Codeunit 1 function name
New Object Type
New Object ID
New function name
CompanyOpen
Codeunit
40
CompanyOpen
GetSystemIndicator
Codeunit
40
GetSystemIndicator
CompanyClose
Codeunit
40
CompanyClose
FindPrinter
Codeunit
44
GetPrinterName
ApplicationVersion
Codeunit
9015
ApplicationVersion
CustomApplicationVersion
N/A
N/A
N/A
ReleaseVersion
Codeunit
9015
ReleaseVersion
ApplicationBuild
Codeunit
9015
ApplicationBuild
CustomApplicationBuild
N/A
N/A
N/A
ApplicationLanguage
Codeunit
43
ApplicationLanguage
DefaultRoleCenter
Codeunit
9170
DefaultRoleCenterID
MakeDateTimeText
Codeunit
41
MakeDateTimeText
GetSeparateDateTime
Codeunit
41
GetSeparateDateTime
MakeDateText
Codeunit
41
MakeDateText
MakeTimeText
Codeunit
41
MakeTimeText
MakeText
Codeunit
41
MakeText
MakeDateTimeFilter
Codeunit
41
MakeDateTimeFilter
MakeDateFilter
Codeunit
41
MakeDateFilter
MakeTextFilter
Codeunit
41
MakeTextFilter
MakeCodeFilter
Codeunit
41
MakeTextFilter
MakeTimeFilter
Codeunit
41
MakeTimeFilter
AutoFormatTranslate
Codeunit
45
AutoFormatTranslate
ReadRounding
Codeunit
45
ReadRounding
CaptionClassTranslate
Codeunit
42
CaptionClassTranslate
GetCueStyle
Codeunit
9701
GetCueStyle
SetGlobalLanguage
Codeunit
43
SetGlobalLanguage
ValidateApplicationlLanguage
Codeunit
43
ValidateApplicationLanguage
LookupApplicationlLanguage
Codeunit
43
LookupApplicationLanguage
GetGlobalTableTriggerMask
Codeunit
49
GetGlobalTableTriggerMask
OnGlobalInsert
Codeunit
49
OnGlobalInsert
OnGlobalModify
Codeunit
49
OnGlobalModify
OnGlobalDelete
Codeunit
49
OnGlobalDelete
OnGlobalRename
Codeunit
49
OnGlobalRename
GetDatabaseTableTriggerSetup
Codeunit
49
GetDatabaseTableTriggerSetup
OnDatabaseInsert
Codeunit
49
OnDatabaseInsert
OnDatabaseModify
Codeunit
49
OnDatabaseModify
OnDatabaseDelete
Codeunit
49
OnDatabaseDelete
OnDatabaseRename
Codeunit
49
OnDatabaseRename
OnDebuggerBreak
Codeunit
9500
ProcessOnDebuggerBreak
LaunchDebugger
Codeunit
9500
OpenDebugger
OpenSettings
Codeunit
9170
OpenSettings
OpenContactMSSales
Codeunit
50
OpenContactMSSales
InvokeExtensionInstallation
Codeunit
2501
InvokeExtensionInstallation
CustomizeChart
Codeunit
9180
CustomizeChart
HasCustomLayout
Codeunit
44
HasCustomLayout
MergeDocument
Codeunit
44
MergeDocument
ReportGetCustomRdlc
Codeunit
44
ReportGetCustomRdlc
ReportScheduler
Codeunit
44
ScheduleReport
OnBeforeOpenSettings
Codeunit
9170
OnBeforeOpenSettings
OnAfterGetApplicationVersion
Codeunit
9015
OnAfterGetApplicationVersion
OnBeforeCompanyOpen
Codeunit
40
OnBeforeCompanyOpen
OnAfterCompanyOpen
Codeunit
40
OnAfterCompanyOpen
OnRoleCenterOpen
Codeunit
9170
OnRoleCenterOpen
OnBeforeCompanyClose
Codeunit
40
OnBeforeCompanyClose
OnAfterCompanyClose
Codeunit
40
OnAfterCompanyClose
OnAfterGetSystemIndicator
Table
79
OnAfterGetSystemIndicator
OnAfterFindPrinter
Codeunit
44
OnAfterGetPrinterName
OnAfterGetDefaultRoleCenter
Codeunit
9170
OnAfterGetDefaultRoleCenter
OnAfterMakeDateText
N/A
N/A
N/A
OnAfterMakeTimeText
N/A
N/A
N/A
OnAfterMakeText
N/A
N/A
N/A
OnAfterMakeDateTimeFilter
Codeunit
41
OnAfterMakeDateTimeFilter
OnAfterMakeDateFilter
Codeunit
41
OnAfterMakeDateFilter
OnAfterMakeTextFilter
Codeunit
41
OnAfterMakeTextFilter
OnAfterMakeCodeFilter
N/A
N/A
N/A
OnAfterMakeTimeFilter
Codeunit
41
OnAfterMakeTimeFilter
OnAfterAutoFormatTranslate
Codeunit
45
OnAfterAutoFormatTranslate
OnAfterCaptionClassTranslate
Codeunit
42
OnAfterCaptionClassTranslate
OnAfterGetGlobalTableTriggerMask
Codeunit
49
OnAfterGetGlobalTableTriggerMask
OnAfterOnGlobalInsert
Codeunit
49
OnAfterOnGlobalInsert
OnAfterOnGlobalModify
Codeunit
49
OnAfterOnGlobalModify
OnAfterOnGlobalDelete
Codeunit
49
OnAfterOnGlobalDelete
OnAfterOnGlobalRename
Codeunit
49
OnAfterOnGlobalRename
OnAfterGetDatabaseTableTriggerSetup
Codeunit
49
OnAfterGetDatabaseTableTriggerSetup
OnAfterOnDatabaseInsert
Codeunit
49
OnAfterOnDatabaseInsert
OnAfterOnDatabaseModify
Codeunit
49
OnAfterOnDatabaseModify
OnAfterOnDatabaseDelete
Codeunit
49
OnAfterOnDatabaseDelete
OnAfterOnDatabaseRename
Codeunit
49
OnAfterOnDatabaseRename
OnAfterHasCustomLayout
Codeunit
44
OnAfterHasCustomLayout
OnAfterReportGetCustomRdlc
Table
9650
OnAfterReportGetCustomRdlc
OnBeforeOnDatabaseInsert
Codeunit
49
OnBeforeOnDatabaseInsert
OnBeforeOnDatabaseModify
Codeunit
49
OnBeforeOnDatabaseModify
OnBeforeOnDatabaseDelete
Codeunit
49
OnBeforeOnDatabaseDelete
OnBeforeOnDatabaseRename
Codeunit
49
OnBeforeOnDatabaseRename
OnEditInExcel
Codeunit
6710
OnEditInExcel
OnInstallAppPerDatabase
N/A
N/A
N/A
OnInstallAppPerCompany
N/A
N/A
N/A
OnCheckPreconditionsPerDatabase
Codeunit
9900
OnCheckPreconditionsPerDatabase
OnCheckPreconditionsPerCompany
Codeunit
9900
RaiseOnCheckPreconditionsPerCompany
OnUpgradePerDatabase
Codeunit
9900
OnUpgradePerDatabase
OnUpgradePerCompany
Codeunit
9900
OnUpgradePerCompany
OnValidateUpgradePerDatabase
Codeunit
9900
OnValidateUpgradePerDatabase
OnValidateUpgradePerCompany
Codeunit
9900
OnValidateUpgradePerCompany

Stay Tuned for more….

 

How to modify standard page layout using extension

15

In this blog we will see how we can modify  standard page by adding few fields and modify property of existing fields.

Adding customize fields in page layout 

For this I assume table extension is already created and now would like to add fields in page layout by creating page extension

In page layout for adding fields you can mention whether you want add fields before/after specified fields or addfirst/addlast in page.

In following example I am adding fields after field VAT Prod. Posting group

pay1

Once you press Shift+F5 then you can see result in page as follows.

pay2

Modifying existing  fields properties  in page layout 

One can modify properties of existing field using modify option in page extension

In this example changing visible property of one of the field in page as per below example

Original page display the field as below

pay3Now we would like to hide this field using visible property so in page extension you can write as below

pay4

Even you can add trigger and write you routine to execute.

Add Action in Page Layout

For adding action once can write following 

pay5

Here is the result in client.

pay6

Hope this help and stay tuned for more.

How to Protect IP Code in Business Central

15Now I know you already started developing app using VS Code and now questions is that how to protect app for viewing the code while debugging or downloading.

However extension development package provide setting for IP protection for viewing or downloading the code of extensions but you can also control by just adding one line code  in app.json file.

app.json file containing setting called showMyCode which controls whether it is possible to debug the code ,By default it is set to false which means debugging in extension code not allowed.

If you want to allow to show extension code then add the line as below in app.json file as by default this setting is not added in app.json file when it is created.

appjson

By adding this setting, you enable debugging into an extension to view the source code when that extension is set as a dependency.

Stay tuned for more.

 

 

 

How to Retain data after publishing App

15

Hope you all started app development and may be wondering how to retain data after publishing app or debugging several times or after adding more sample data.

How do I retain the sample data so every time no need to add the same data.  ?????

In Business central you can synchronize the sample data while publishing several times. This can be done by simple settings in launch .json file.

lanuchjson

Once you mention this settings then the  data synchronize is controlled by this settings.

This settings consist of two options i.e. Synchronize and Recreate .

The default value is synchronize which means data will be retain every time when the app get published.

When schemaupdate set to Recreate mode then all the tables and table extensions are recreated every time and data will get lost.

When schemaupdate set to Synchronize then:

Do’s

  1. Add more field in table
  2. Increase length of field.

Don’t

  1. Don’t delete the field which contains sample data as if the field is removed from table then data can not be synchronize
  2. Don’t decrease the length of field for code and text datatype.

For above points you need to write upgrade code units or set schemaupdate to recreate.

In next blog will see how to write upgrade code units.

Stay tuned for more…

 

 

 

 

 

 

 

 

User and Workspace Settings in Visual Studio Code

I hope you already started working with Visual studio code.

In this section we will see how to do setting for User and workspace in Visual Studio code environment.

It is easy to configure visual studio code as per your likings using various settings. You can change VS code editor ,user interface and functioning by using this settings

There are three ways you can open user and workspace settings

  1. To access you can go to  Click on File–>Preferences–>Settings

User1user2

2) Using Command Palette(Ctrl+Shift+P)  by typing

Preferences: Open User Settings  or Preferences : Open Workspace Settings

user3

3) Use keyboard shortcut (Ctrl+,)

This provides two different settings

  • User Settings – Settings that apply globally to any instance of VS Code you open.
  • Workspace Settings – Settings stored inside your workspace and only apply when the workspace is opened.

Workspace settings override user settings.

How to create user settings 

Once you open settings then you can modify settings as below

Example. If I want to change font size in editor then I can do it from here

 

Change the font size and see the effect on editor.

user6

It shows the effect immediately after saving the file.

Same kind of settings you can do it for AL language extension management

user7These changes get saved in %APPDATA%\Code\User\settings.json

Hope this will help you while extension development

Stay tuned for more…

Cheers…

 

 

 

 

Setup Visual Studio Code for local NAV server Installation

In this section we will see how do we setup Visual studio code locally on NAV 2018 server.

Hereby I assume that NAV 2018 is already installed on local machine .

You can download Visual studio code from Visual Studio Code

After Installing NAV 2018 and Visual Studio Code follow following steps to enable Visual studio code for writing extension and AL code.

  1. Enable Developer Service endpoint from NAV server instance

Developer End Point

2) Setup Web Client Base URL

Mention the web client url address .for example :- http://localhost:8080/dynamicsnav110/

WebClientURL

Once all changes done in service then restart the service.

3) Open Visual studio code and Install VSIX file from media 

InstallVSIX

You will find .vsix file in NAV 2018 Media file in folder ..\NAV.11.0.22292.W1.DVD\ModernDev\program files\Microsoft Dynamics NAV\110\Modern Development Environment\ALLanguage.Vsix

This will install AL language in visual studio code

4) Press CTRL+SHIFT+P and select command AL:GO in order to select a location and create a folder with default file of an extension

5) Setup Launch .JSON file

JSOn

Change server instance to DynamicsNAV110 and authentication to Windows

6) Press CTRL+SHIFT+P  and use command to download symbols AL:Download Symbols

7) Pres CTRL+F5 to publish the Helloworld.AL extension which extends customer list page and same id is mention in startupobjectid parameters of launch .json file

AL1

Once publish you will get following in web client

2

Get ready for extension development with this….

Cheers…

 

 

 

 

MS NAV Updates for September-2017

th

Following are updates for MS NAV for month of September

Update for Development Preview

https://blogs.msdn.microsoft.com/nav/2017/09/07/nav-development-preview-september-update/

Lot of issues pointed out on GitHub is fixed in this development preview update. You can visit GitHub for more info :-https://github.com/Microsoft/AL/issues

 

Released Cumulative Updates

NAV 2017 CU 10 :- https://www.microsoft.com/en-us/download/details.aspx?id=55797

NAV 2016 CU 23 :- https://www.microsoft.com/en-us/download/details.aspx?id=55798

NAV 2015 CU 35 :- https://www.microsoft.com/en-us/download/details.aspx?id=55796

 

Cheers!!!!

 

 

 

 

February Update for NAV Development Tool

As the NAV development tool getting updated every day based on the issues reported on GitHub and MS team is continuously updating the development tool

Refer following link for update for this month

https://blogs.msdn.microsoft.com/nav/2017/02/16/nav-development-tools-preview-february-update/

 

Page Extension -Tenerife Visual Studio Code

In previous post Table Extension we saw how to extend table using Tenerife (New NAV development tool) .In this blog post we will see how to extend Pages using visual studio code.

The page objects extends a dynamics NAV page object .This will used for add or overrides the functionality.The structure of page is divided into three parts

  1. First part contains metadata for the entire page
  2. Second part describes visual parts on page
  3. Final Part describes action published on page

In visual studio typing tpageext will create the basic layout for page object when using AL extension in Visual Studio code.

 How to Write Code 

For example if you would like to add the custom field and Action button then you can wrtie code as follows.

pageextension

pageextension 70000030 VendorCardExtension extends "Vendor Card"
{
 layout
 {
 addlast(General)
 {
 field("Credit Days"; CreditDays)
 {
 CaptionML = ENU='CreditDays';

 trigger OnValidate();
 begin
 if CreditDays < 0 then
 Error('Credit Days Can not be blank');
 end;
 }
 }

 }

 actions
 {
 addlast(Creation)
 {
 group(MyActionGroup)
 {
 Action(MyAction1)
 {
 trigger OnAction();
 begin
 Message('Action Button is operating');
 end;
 }
 
 }
 }
 }

}

Keep Learning and Stay tuned for more updates…

Cheers…

Create Table Extension with Tenerife-Visual Studio Code

At the moment Microsoft development tool is still evolving and getting updated day by day.

In this blog post we will see how how to create Table extension object.

The table extension allows you to add more fields or change properties on a table. Along with defining other fields,the table extension is where you can write trigger code for additional fields.

In visual studio code by typing ttableext will create basic layout for table extension object when using AL extension in Visual Studio code.

Following properties can be changed for table

  1. Width
  2. OptioncaptionML
  3. Description
  4. ClosingDates

How to Write Code 

For example now if you would like to add one field in table and write some validation on that field then you can write as follows. In this I am adding field in Table 23 Vendor as Credit Days with datatype Integer.

tableextension 70000030 CreditDays extends Vendor
{
fields
{
field(70000900;CreditDays;Integer) 
{
trigger OnValidate();
begin
if (rec.CreditDays < 0) then
begin
message('Credit Days can not be blank');
end; 
end;
}
}
}

Stay tuned for more and Keep updating and learning .

Cheers