Changes/updates in AL Runtime 14.0 or above in Business Central 2024 release wave 2

31-10-2024

 

Lot of new methods/changes has been introduced in runtime 14.0

Let us see some of them, how to use and what are the benefits.

• Ternary Operator

• AL Explorer Wildcard Search

• Profile Extension Objects

• Positive List Page Customizations

• New Date, Time & DateTime Methods

• SaveAsJson on the Query Object


Ternary Operator

Ternary (conditional) operator has been added in AL language. It is known from other programming languages as streamlines conditional operations that enhances readability and reduces verbosity, particularly useful for simple conditions which promotes code clarity.

Let us see this in action.


Earlier we use:

procedure GetResult(success: Boolean): Text;

begin

    if success then

        exit('Passed')

    else

        exit('Failed');

end;


Now we can use:

procedure GetResult(success: Boolean): Text;

begin

    exit(success ? 'Passed' : 'Failed');

end;


AL Explorer Wildcard Search

Wildcard improves the search functionality in AL Explorer by supporting * and ? wildcards.

* means zero or more characters 

? means any single character


Some examples:

Customer* will starts with Customer

*Card will ends with Card

Customer*Card will start with Customer and end with Card

*Customer* will have Customer anywhere


Profile Extension Objects

Now we can extend profile objects and can be used to modify the target profile's caption, role center, and add/remove from the role explorer.


profileextension ProfileExtension extends "Sales Processor"

{

    Caption = 'Sales Processor Profile Extension';

    ProfileDescription = 'Sales Processor Profile Extension Description';

    Enabled = true;

    Promoted = true;

    RoleCenter = 9001;

}


Positive List Page Customizations

Page customizations can be used to tailor the interface for users of a specific role. 


Since page customizations can hide elements such as controls, actions, or views, they are suited for defining a negative list of elements. However, any visible element that is not referenced by the page customization would be shown on the page, including elements defined in other extensions. 

Now, it is possible to create a positive list of elements to be shown on the page using the properties ClearActions, ClearLayout, and ClearViews.


The following example sets the customer card to only show the customer Name and the promoted Email action.

pagecustomization CustomerCardCustomizes customizes "Customer Card"

{

    ClearActions = true;

    ClearLayout = true;


    layout

    {

        modify(Name) { Visible = true; } 

    }


    actions

    {

        modify(Email_Promoted) { Visible = true; } 

    }

}


New Date, Time & DateTime Methods

AL language modernized the Date/Time/DateTime objects for extracting sub-components of the below types.


SaveAsJson on the Query Object

AL language now supports SaveAsJson on the Query object.

The following examples show how to use the SaveAsJson.


procedure SaveAsJson();

var

    Result : Boolean;

    OutStream: OutStream;

begin

    Result := Query.SaveAsJson(10, OutStream);

end;


For more information on changes in AL development, please refer the below link.

https://learn.microsoft.com/en-us/dynamics365/release-plan/2024wave2/smb/dynamics365-business-central/planned-features#development