New Features for Dynamics 365 Business Central 2021 release wave 1 (BC18): Returning complex types

Dynamics 365 Business Central

Hi, Readers.
Last week, the preview environment for Dynamics 365 Business Central 2021 release wave 1 (BC18) is available. Learn more: https://yzhums.com/10601/.

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

In-app contextual help improvements:

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;
var
Customer: record Customer;
begin
Customer.SetFilter(Name, ‘@’ + Name + ‘*’); Customer.FindFirst(); exit(Customer);
end;

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”

So as described in the release plan, you can now return variables of complex types like following. I am so touched that this used to be the dream of every C/AL and AL developer.

I have listed all return types of the BC17.5 and BC18. Hope this will help.

Return types in BC17.5:

Return types in BC18:

All Return types in AL: The red contents are the new types added in BC18.

BC18.0BC17.5
arrayarray
ActionAction
AuditCategory 
BigIntegerBigInteger
BigText 
BooleanBoolean
ByteByte
CharChar
Client typeClient type
CodeCode
Codeunit 
DataClassificationDataClassification
DataScopeDataScope
DateDate
DateFormula 
DateTimeDateTime
DecimalDecimal
DefaultLayoutDefaultLayout
Dictionary 
DurationDuration
EnumEnum
ErrorInfoErrorInfo
ErrorTypeErrorType
ExecutionContextExecutionContext
ExecutionModeExecutionMode
FieldClassFieldClass
FieldRef 
FieldTypeFieldType
FilterPageBuilder 
GuidGuid
HttpClient 
HttpContent 
HttpHeadersHttpHeaders
HttpRequestMessage 
HttpResponseMessage 
Instream 
IntegerInteger
Interface 
JsonArrayJsonArray
JsonObjectJsonObject
JsonTokenJsonToken
JsonValueJsonValue
KeyRef 
List 
ModuleDependencyInfoModuleDependencyInfo
ModuleInfoModuleInfo
Notification 
NotificationScope 
ObjectTypeObjectType
OptionOption
OutStream 
Page 
PageBackgroundTaskErrorLevelPageBackgroundTaskErrorLevel
Query 
Record 
RecordId 
RecordRef 
Report 
ReportFormatReportFormat
SecurityFilterSecurityFilter
SecurityOperationResult 
SessionSettings 
TableConnectionTypeTableConnectionType
TelemetryScopeTelemetryScope
TestPermissionsTestPermissions
TextText
TextBuilderTextBuilder
TextEncodingTextEncoding
TimeTime
TranscationModelTranscationModel
TranscationTypeTranscationType
Variant 
VerbosityVerbosity
VersionVersion
XmlAttributeXmlAttribute
XmlAttributeCollectionXmlAttributeCollection
XmlCDataXmlCData
XmlCommentXmlComment
XmlDeclarationXmlDeclaration
XmlDocumentXmlDocument
XmlDocumentTypeXmlDocumentType
XmlElementXmlElement
XmlNamespaceManagerXmlNamespaceManager
XmlNameTableXmlNameTable
XmlNodeXmlNode
XmlNodeListXmlNodeList
XmlPort 
XmlProcessingInstructionXmlProcessingInstruction
XmlReadOptionsXmlReadOptions
XmlTextXmlText
XmlWriteOptionsXmlWriteOptions

Update 2021/04/15: Information from Dynamics 365 Business Central Launch Event 2021 release wave 1

END

Hope this will help.

Thanks for reading.

ZHU

コメント

Copied title and URL