Overloading functions can be really useful and can save a lot of time. We can have one predefined function with the same name and use it whenever we want for a specific need.

Overload Example

Here it is an example of two overloaded functions that look for the last line number of two different tables. The name of the function is the same but it will behave differently depending on the parameters we use to call it.

When we call the function (Ctrl + Space) LastLineNoF we can see that there is one overloaded function:

And when we select the function we can see the overloaded functions (Ctrl + Shift + Space) with its parameters:

So the final code will be as simple as the following. This code inserts a new line in a given invoice.

Overloaded functions are pretty easy to use and add functionality. For this example we can add a function for Sales Shipment Lines, Journal Lines, etc.

Hope you find this post useful.

How To Use Overload Functions In Business Central

Post navigation

Leave a Reply

Your email address will not be published. Required fields are marked *