Do you remember this post where in I explain the use of showmycode property from app.json file. With this property we have only one option either we allowed to debug and download your app or vice versa.
Now with new version of AL language this property has been deprecated and new property has been introduced resourceExposurePolicy where in we get leverage to control your app from debug ,download the app file.
This property will be automatically added when new project is created as below.
If you can see in this property we have three options which can be used to control the app and your IP.
AllowDebugging :- Allow to control the debugging of your app when it is published. The default setting is true.
AllowDownloadingSource :- Allow to control the download of your app source code .The default setting is false.
IncludeSourceInSymbolFile: Allow to control symbol to be included in the source code of package. The default setting is false.
Can I add resourceExposurePolicy and showmycode property together ?
With the introduction of this new property in app.json file we can not use showmycode property as it will show an error and warning as below.
Hopefully this will help us to control our IP and provide more security on our app.
With the release of Wave 1 2021 lot of new feature introduced . One of the new feature is that partners now can add keys in base table with customized field which was not possible earlier
Today we will see how we can do that
First Lets see what is happening is earlier version of business central. In earlier version we can only add the keys with the field added on table extension and we are not able to see the field available in base table for adding in keys
Look at the following example as I created one simple extension in V17 and trying to add key
Now when I try to add the keys in this table extension it will populate only those fields which are added in table extension
In New version of Business central i.e. Wave 1 2021 we can Add more keys with base table fields and use to improve the performance while retrieving or updating records
Now look at the following example for new version .Just created a simple table extension
Now when I try to add the keys in this table extension it will populate all the fields available in base table as below
So that means we can create keys with
Fields from base table
Fields from table extension
Can I create combination of fields from base table and fields from table extension ?
And the obvious answer is no and reasons are simple that both base table and table extension are two different tables in Sql server.
If you would like to add documentation to your code then you can use XML documentation .The documentation comment must immediately before the object such as codeunit,table,functions etc.
The syntax for adding XML comments in your code is triple slashes /// followed by one of the supported XML tags. There is IntelliSense support for writing documentation comments. Most importantly providing a template documentation comment when writing the third slash in the triple slash.
These documentation comments are visible when hovering over source symbols.
XML document comment will improve readability ,add useful information about the code implementation and help others take over your code .
With XML comments it also enable intellisense in AL objects that you add in your code as a help to other developers who is going extend your code.
Let sees an example how we can add the xml comments.
Created one simple code unit where we can add documentation comments.
Please note that If you have the showMyCode setting in the app.json file set to false and download an app package; the app package will not contain any XML comments.
The partial records capability is allows for loading a subset of normal table fields when accessing the data source based on SQL.
To access the data source we use GET ,FIND NEXT. When we use these methods then runtime it load all fields and will hamper the performance while fetching the records.
Now from business central wave 2 2020 we can use ‘Partial records’ capability.
To accommodate partial records following methods available in business central. These methods are avaaible on RecordRef and Record datatype in AL. These methods are loaded in two groups i.e. Subsequent loads and Current load
Specifies a set of fields to be initially loaded when the record is retrieved from its data source.
Adds fields to the current set of fields to be initially loaded when the record is retrieved from its data source.
Checks whether the specified fields are all initially loaded.
Accesses the table’s corresponding data source to load the specified fields.
Lets See few examples of these methods
Following example is for summation of Quantity fields from Item Ledger Entry .In this we would like to make calculation of only Quantity fields and not require the others fields to be loaded.
If you see SetLoadFields is call before data fetching operation starts. This will determine which fields needed for Find Set Call.
Advantage of this is that it gives you ability to load only those fields which are required to perform the operation which will make execution of code faster and give more performance. This feature is recommended to use while fetching the records and not for Insert,Modify or Delete operation.
Using the above method we added the required fields but what will happen to other fields which hasn’t been loaded .In such cases platform does an implicit GET and loads the missing fields, called as JIT Loading (Just in Time).
When JIT loading occurs, another access to the data source is required. These operations tend to be faster because they’re GET calls. GET calls can often be served by the server’s data cache or become clustered index seeks on the database.
Iterating over records in the database, enumerator is created based on selected fields and row is fetched when NEXT is called. but certain operations will not follow enumerator like if we passing a record by value and not by VAR .This operation actually creates new copy of the record and original records and copy of the record not share the filters ,selected field for loading. That means to access unloaded fields it need to trigger JIT load and but it will not update enumerator which means for future iterations also require JIT load.
To overcome such situations we can do following
Pass the record reference using VAR.
Call AddLoadFields on the original records before passing by value.
Use SetLoadFields before calling FIND,GET,NEXT.
Hope this will help you to understand for partial records and stay tuned for more updates.
For more updates you can follow my blog on following channels.
Though above warning was informed by MS long time back but it has introduced in latest version of AL.
With the update of new version of AL extension this warning is populated in AL code.
Once you update above AL language version then you will find below warning
Now this warning will become error in near future that means we need to correct it anyhow . If your app contain more than 100 pages then it will be too much efforts to make it manually and tedious task.
To make it superfast work we have one extension available in marketplace which will help you to resolve it within seconds.
Once you install the extension then Press ‘F1’ and run following command
‘Fix Implicit with usages’
Just have look at the following file
Now run above command and relax as it will fix the warning in all pages.