Skip to main content

Posts

Change CaptionClass property in Business Central

  How to change CaptionClass property in Business Central with the help of AL code? Last week, I had a request to change a caption of County in the Customer Card. So, I had checked in the Customer Table, County caption is coming from CaptionClass property in Business Central. Now, we do not have an access to change this CaptionClass property in Business Central with the help of Page Extension. So, what we can do to change the caption of CaptionClass property   in Business Central? Caption in the business central is managed through codeunit 42 ( Caption Class ). We can make a change the caption of the field which has CaptionClass property in the Business Central with the help of event subscriber where we need to check Caption Area i.e. '5'   and what it contains after that i.e. '1,' . This way we can change Caption of CaptionClass property in Business Central. Now, changed caption of CaptionClass will be look like below screenshot. Regards, Harshil Patel | www.t
Recent posts

How to add editable field in Ledger Entries in Business Central?

  How to add editable field in Ledger Entries in Business Central? Many times we need to make an editable field in the business central on Customer Ledger entries or General Ledger Entries or Item Ledger Entries. On the Ledger  Entries, we can not add directly editable fields on the page because these Ledger Entry pages are designed to not allow modify fields because of below code. So, I want to add field called comment on the General Ledger Entries. Now, what we can do if we want to add editable field on the General Ledger Entries? Firstly, we will extend table and add comment field and then will extend general ledger entries and add our field at the last. tableextension   50261  tableextension50261  extends  "G/L Entry" {      fields     {          // Add changes to table fields here          field( 50261 ; Comments;  Text [ 250 ] )         {              DataClassification  = CustomerContent;             Caption =  'Comments' ;         }     } } pageextension  

Field Group in business central

  How to setup field group in business central? We can display a dropdown control on a page with the help of field group in the business central. This is the same thing that we are practicing in navision but the only difference is the style of defining field group. We can define field group in the table or table extension. In table object, first we will define field groups control then we have to enter one more control called fieldgroup(<Name>;Field) in the business central. We can use DropDown or Brick as Name to display data tile. Field is a comma separated list of fields. Important Points that can be taken care while using field group A field group can also be used to specify fields that display when list pages are shown in the tile view. The  fieldgroups

Control Add-in in Business Central

How to use Control Add-In in Business Central? I have come across with Control Add-In once one of our customers wants have custom layout for their sales. I was searching that how we can fulfill their requirement in the business central. I have gone through several blogs regarding my requirement. At the end, I have found that we can achieve this with the help of Control Add-In in the business central. We can use Control Add-In to integrate Java Script with AL in the business central. Moreover, we can do some stuff related to UI with the help of Control Add-In . https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-control-addin-object I think Microsoft has given good documentation on Control Add-In in business central. We can easily understand how we can use this for our requirement. Basically, it has main two things in Control Add-In . One is define event in Control Add-In, which will use to call AL from Java Script. Another thing is define pr

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.")                  {