Business Central 2023 wave 2 (BC23): Get smarter method signature recommendations in IntelliSense (Function Overloads – Smarter function signature recommendations)

Dynamics 365 Business Central

Hi, Readers.
The public preview for Dynamics 365 Business Central 2023 release wave 2 (BC23) is available. Learn more: Link.

I will continue to test and share some new features that I hope will be helpful.

Get smarter method signature recommendations in IntelliSense:

Business value:
One of the most common uses of IntelliSense when authoring code is getting parameter help on methods. IntelliSense is a great help, but not when showing options that don’t apply. Until now in AL, when there were multiple method overloads, the user would have to switch between them to get help matching the chosen overload. In this release, IntelliSense will be smarter and actually prioritize the first valid overload.

As you might know, in some programming languages, procedure overloading or function overloading is the ability to create multiple functions of the same name with different implementations.

Procedure overload enables developers to create multiple procedures with the same name, but with different signatures, on the same application object. Conceptually, overloaded procedures are used to execute the same task on a different set of arguments. When an overloaded procedure is called, a specific implementation of that procedure, appropriate to the context of the call, will be run.
For example, in codeunit 8901 “Email”: procedure SaveAsDraft()

Reasons for using procedure overload: Overloaded procedures give programmers the flexibility to call a procedure with similar semantics for different types of data. At the same time, overloaded procedures remove the need for abusing the Variant data type for the purpose of processing different types of data in a similar manner and allows the developer to write strongly-typed code and rely on the compiler for validation. More details: Procedure overload

In this wave, the AL Language extension will now reorder and prioritize relevant overloads when the developer starts typing a method invocation. If the typed expression corresponds to a valid overload, it will always be the first recommendation and the correct active parameter will be highlighted. The rest of the recommendations will be sorted in the order of relevance based on the provided parameters.

Small update, but it makes life easier. Give it a try!!!😁

PS: It is also mentioned in AL Language extension changelog Version 12

My test code:

codeunit 50113 StringifierWithOverloads
    procedure ToString(value: Text; value2: Text): Text;
        Exit(value + value2);

    procedure ToString(value: Text; value2: Date): Text;
        Exit(value + Format(value2));

    procedure ToString(value: Text; value2: Integer): Text;
        Exit(value + Format(value2));

pageextension 50112 MyExtension extends "Customer List"
    trigger OnOpenPage();
        StringifierWithOverloads: Codeunit StringifierWithOverloads;
        value: Text;
        value2: Integer;
        StringifierWithOverloads.ToString(value, value2);


Hope this will help.

Thanks for reading.



Copied title and URL