Returning complex types


Some of the functionality described in this release plan has not been released. Delivery timelines may change and projected functionality may not be released (see Microsoft policy). Learn more: What's new and planned

Enabled for Public preview General availability
Admins, makers, marketers, or analysts, automatically Feb 1, 2021 Apr 2021

Business value

You can now simplify your AL code and return complex types, instead of passing these in the method parameters.

Feature details

You can now return variables of complex types.

As an example, the following method will take a name and return the first customer record that matches the name. Notice how the signature specifies the return type at the end of the procedure declaration, and how the procedure exits by returning the found customer record.

procedure GetCustomerByName(Name: Text): record Customer;
    Customer: record Customer;
    Customer.SetFilter(Name, '@' + Name + '*');

You can use this new feature to call members directly on the returned variable—for example, in expressions. As an example, you could use the above in an IF statement such as "if GetCustomerByName('SomeName')."Balance (LCY)" > 0 then"

Read more about this new feature: Return of the Complex Type

Tell us what you think

Help us improve Dynamics 365 Business Central by discussing ideas, providing suggestions, and giving feedback. Use the forum at

Thank you for your idea

Thank you for submitting this idea. We listened to your idea, along with comments and votes, to help us decide what to add to our product roadmap.