web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :

Dynamics 365 Business Central: returning complex types from AL

Stefano Demiliani Profile Picture Stefano Demiliani 37,166 Most Valuable Professional

I think that every AL developer dreams that a day AL will be a full Object Oriented programming language like C# or others. Unfortunately, AL is born from C/AL and its main purpose is to write business logic inside a business application like an ERP in the cloud, it’s not a language that will be used for writing every type of apps. But that is… don’t stop to suggest things, don’t stop to propose ideas, something is cooking…

How many times for example you had the need to write a procedure that return complex types like a Customer record? You cannot do that now, but…

From Business Central 2021 Wave 1 most types can be returned from procedures – both user-defined types and most built-in types

This means that you can now write something like:

and you can also use the complex return type directly as part of other expressions, like:

Unfortunately, you cannot actually return a List of complex types like in the following example:

This was asked a lot, but there are 2 months until April…

You can also return built-in types like for example:

As you can see, here I’m calling a web service (with a GET request) and the procedure directly returns a HttpResponseMessage object.

You can also return other complex types like:

Cool isn’t it? Small things for a C# developer, but a huge improvements for AL…


This was originally posted here.

Comments

*This post is locked for comments