Skip to main content


Showing posts from October, 2020

SetLoadFields in Business Central

How to Use SetLoadFields in Business Central? SetLoadFields is a wonderful characteristic of business central wave 2 2020. Conventionally, we are used to load all fields data together whenever we fetch records from table. At that moment, I think it fires a  Select * From Table query in the background. So, it will take little bit more timing in retrieving the data. We can reduce this time with the help of  SetLoadFields when we use this function. I suppose it will use Select Field From Table query to fetch the data. This will impact a lot as far as performance is concerned. Also, we can use  SetLoadFields with Setrange and Setfilter to get our desire records. Here, I have used  Setfilter  along with  SetLoadFields. pageextension   50100  CustomerListExt  extends  "Customer List" {      trigger  OnOpenPage () ;      var         Item:  Record  Item;         total:  Decimal ;      begin         Item . Reset () ;         Item . SetFilter ( "No.",  '%1|%2' ,  &

Business Central: obsoleting WITH statement

Today, I have been checking some of my extensions for business central 17 compatibility. Majorly, I found that it is giving a warning for with statements. After that, I checked some blogs on the google and found that it is going to be obsolete soon in the newer version of business central. With clause can help us to write a more readable source code for our customization. In fact, Microsoft is already using this with clause many times the we have seen in the Navision as well as in the business central. We have to change our code for solving this problem as soon as possible. Many people are asking that it is just a warning why we need to take care today but my answer is always to change your code as earliest as possible for not creating mess at the deadline. I hope you will understand the seriousness of handling With clause. After changing code when you compile source you will not get a warning for code AL0606.

Protected Variable in AL

We can make a global variable accessible from table to table extension, or from page to page extension, you would normally need to create a procedure to get or set the variables. With protected variables, you no longer need to do that. The protected keyword can be used to make variables accessible between tables and table extensions and between pages and page extensions. If you want to only expose some variables as protected, you must create two sections of variables declarations. Let me give an example to get a better understanding. I have a core extension with a new page called “My Item List”. 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 page 70102 "My Item List" {        Caption = 'My Item List';      PageType = List;      SourceTable = Item;        layout      {          area(content)          {              repeater(General)              {                  field("No."; Rec."No.")                  {