[ESP] En el siguiente enlace puedes ver leer los cambios relacionados a la versión vigente:
[ENG] En el siguiente link, you can read the changes related to the current version:

15.0
Implicit conversion between Record and RecordRef
We have introduced support for implicit conversion between Record and RecordRef instances, allowing direct assignment between these types.
codeunit 10 RecordAndRecordRefConversion
{
procedure RecordToRecordRef()
var
Customer: Record Customer;
RecRef: RecordRef;
begin
RecRef := Customer; // Similar to RecRef.GetTable(Customer);
ProcessRecord(Customer); // Argument conversion
end;
procedure RecordRefToRecord()
var
Customer: Record Customer;
RecRef: RecordRef;
begin
Customer := RecRef; // Similar to RecRef.SetTable(Customer); This will cause an error if the table is different
ProcessCustomer(RecRef); // Argument conversion.
end;
procedure ProcessCustomer(r: record Customer)
begin
Message('Process Customer');
end;
procedure ProcessRecord(rr: RecordRef)
var
Customer: record Customer;
begin
case rr.Number of
Database::Customer:
Message('Process Customer');
else
Error('Unable to process record');
end;
end;
}
Mocking HTTP calls in AL tests
We have introduced a new handler type HttpClientHandler to allow mocking the response of HTTP requests in test codeunits. This feature allows for more controlled and easier testing of modules that interact with external services. The feature is limited to OnPrem instances only.
HttpClientHandler
When an HttpClientHandler is added to a test method, every HTTP request that occurs during the execution of that test will be intercepted and routed to the handler. The handler method signature is as follows: it receives a TestHttpRequestMessage that contains information about the HTTP request, as well as a TestHttpResponseMessage that contains the mocked HTTP response values that should be updated by the handler. The Boolean return value indicates whether to fall through and issue the original HTTP request (true) or to use the mocked response (false).
TestHttpRequestPolicy Property
We have also introduced a new property on test codeunits called TestHttpRequestPolicy. This property determines how outbound HTTP requests are treated during test execution and has the following possible values:
- BlockOutboundRequests: Any HTTP request issued during the test execution that is not caught and handled by an HTTP client handler will raise an exception.
- AllowOutboundFromHandler: All HTTP requests issued during the test execution are required to be caught by an HTTP client handler. The handler is allowed to explicitly fall through to issue the original request to the external endpoint.
- AllowAllOutboundRequests: All outbound HTTP requests issued during the test execution are allowed.
Example code
codeunit 10 MyCodeunit
{
procedure MethodWithHttpRequest()
var
Client: HttpClient;
Response: HttpResponseMessage;
begin
Client.Get('http://example.com/', Response);
end;
}
codeunit 11 MyCodeunitTests
{
Subtype = Test;
TestHttpRequestPolicy = AllowOutboundFromHandler;
[Test]
[HandlerFunctions('HttpClientHandler')]
procedure TestUnauthorizedResponseHandled()
var
MyCodeunit: Codeunit "MyCodeunit";
begin
MyCodeunit.MethodWithHttpRequest();
end;
[HttpClientHandler]
procedure HttpClientHandler(request: TestHttpRequestMessage; var response: TestHttpResponseMessage): Boolean
begin
// Mock a '401 Unauthorized' response for the 'GET http://example.com/' request
if (request.RequestType = HttpRequestType::Get) and (request.Path = 'http://example.com/') then begin
response.HttpStatusCode := 401;
response.ReasonPhrase := 'Unauthorized';
exit(false); // Use the mocked response
end;
// Fall through and issue the original request in case of other requests
exit(true);
end;
}
Searchable downloaded symbols and using them as context in Copilot Chat
Objects from downloaded symbol packages can now be added as context when using the Github Copilot Chat extension (prerelease version 0.24.2024121201) and Visual Studio Code Insiders (version 1.97 and later). It will also be possible to search and navigate to objects coming from downloaded symbol packages via the ‘Open Symbol by Name’ functionality (Ctrl + T). Additionally, the performance of searching workspace symbols has been improved to support the now larger amount of available symbols.
UserControlHost PageType
We have introduced a new PageType UserControlHost. This page type can be used to only render a single usercontrol in the client. With the UserControlHost page type, the layout is optimized by the client to maximize the available space for the usercontrol.
This new page can only have a single control of type usercontrol within the layout Content area.
Actions cannot be specified on this page, and limited properties and triggers are available for it. It is also not extensible.
Multiline strings
AL now has support for multiline string literals. A multiline string must be prefixed with @.
var
t: Text;
begin
t := @'This is
a
multiline
string
';
end;
Continue statement
From runtime version 15, it is possible to use the continue keyword in loops to continue to the next iteration.
Preview support in File
Two new methods to open and view a file on the client.
[Ok :=] File.ViewFromStream(Stream: InStream, FileName: String [, AllowDownloadAndPrint: Boolean]);
[Ok :=] File.View(FilePath: String [, AllowDownloadAndPrint: Boolean]);
New methods access properties and array elements
We have improved the API for accessing JSON data with a new set of methods that will avoid always to read data through a JsonToken.
For JsonObject instances we have added:
value := GetBoolean(Key: Text [; DefaultIfNotFound: Boolean])
value := GetByte(Key: Text [; DefaultIfNotFound: Boolean])
value := GetChar(Key: Text [; DefaultIfNotFound: Boolean])
value := GetInteger(Key: Text [; DefaultIfNotFound: Boolean])
value := GetBigInteger(Key: Text [; DefaultIfNotFound: Boolean])
value := GetDecimal(Key: Text [; DefaultIfNotFound: Boolean])
value := GetOption(Key: Text [; DefaultIfNotFound: Boolean])
value := GetDateTime(Key: Text [; DefaultIfNotFound: Boolean])
value := GetDate(Key: Text [; DefaultIfNotFound: Boolean])
value := GetTime(Key: Text [; DefaultIfNotFound: Boolean])
value := GetDuration(Key: Text [; DefaultIfNotFound: Boolean])
value := GetText(Key: Text [; DefaultIfNotFound: Boolean])
value := GetArray(Key: Text [; DefaultIfNotFound: Boolean])
value := GetObject(Key: Text [; DefaultIfNotFound: Boolean])
For JsonArray instances we have added:
value := GetBoolean(Index: Integer [; DefaultIfNotFound: Boolean])
value := GetByte(Index: Integer [; DefaultIfNotFound: Boolean])
value := GetChar(Index: Integer [; DefaultIfNotFound: Boolean])
value := GetInteger(Index: Integer [; DefaultIfNotFound: Boolean])
value := GetBigInteger(Index: Integer [; DefaultIfNotFound: Boolean])
value := GetDecimal(Index: Integer [; DefaultIfNotFound: Boolean])
value := GetOption(Index: Integer [; DefaultIfNotFound: Boolean])
value := GetDateTime(Index: Integer [; DefaultIfNotFound: Boolean])
value := GetDate(Index: Integer [; DefaultIfNotFound: Boolean])
value := GetTime(Index: Integer [; DefaultIfNotFound: Boolean])
value := GetDuration(Index: Integer [; DefaultIfNotFound: Boolean])
value := GetText(Index: Integer [; DefaultIfNotFound: Boolean])
value := GetArray(Index: Integer [; DefaultIfNotFound: Boolean])
value := GetObject(Index: Integer [; DefaultIfNtFound: Boolean])
New Command in VSCode to start a new project from a template
We have added a new command AL.NewProject. From this it is possible to start a new project from a template.
New IncStr method overload
A new overload of the IncStr method was added to support an arbitrary positive increment. This allows for incrementing number series or other similar series by more than one position in one go.
New VS Code actions from the Web Client
Two new actions have been added to the Extension Management page. One to generate launch configurations in your local AL project to match the environment, and another to select installed extensions and download them as dependencies.
Github Issues
- #7787 Rule AA0234 implemented inconsistently?
- Added warning AL0864 when having controls of
ChartParttype, since they are not supported by the web client. From runtime version 16.0, this will turn into the error AL0855. - #7746 Misleading ToolTip on RunTime in App.Json
- #7873 False positives for warning AA0234
- #7880 Interface XML comments are not properly handled. They are ignored
- #7898 AA0205 is fired for assigned variables when combined with THIS keyword
- #7846 Wrong tooltip in TableRelation when table name matches top-level namespace name
- #7924 AA0242 is thrown when «Rec.AddLoadFields» is used after «Rec.SetLoadFields»
- #7769 The AL Server crashed 5 times in the last 3 minutes
- #7801 AA0218 not working as expected for dependent fields
- #7965 ALDoc – Referenced module not loaded. Name:’Application’
- #7968 AS0064 is thrown even if interface is Access=Internal
- #7963 The AL compiler builds invalid permission XML files when it contains only few permissions
- #7969 Missing AL0185 for page parts
- #7964 Error AS0003 when compiling any app with AppSourceCop enabled – MacOS
- #7974 InlayHint fails
- #7979 ALDoc skips documentations for objects with ampersand
- #7885 No object ID suggested when namespace is used
- #7981 ALDoc skips documentation if procedure param record has ampersand
AppSourceCop
- Updated rule AS0128 to allow removing a previously obsoleted interface from the list of extended interfaces.
- New rule AS0130 that warns against duplicate object names across namespaces.
- Updated rule AS0064 to allow removing a previously internal interface from the list of implemented interfaces.
PerTenantExtensionCop rules
- New rule PTE0025 that warns against duplicate object names across namespaces.
Reporting
- Added the
ObsoleteState,ObsoleteReason, andObsoleteTagproperties to the Report Layout to enable marking a layout as obsolete. - Added the
ExcelLayoutMultipleDataSheetsproperty to the Report Layout to specify whether an Excel layout should be rendered with multiple or a single data sheet. - Add new Excel data sheet when adding root level data items and the layout uses multiple data sheets.
- Add new layout information fields in the aggregated metadata sheet for the Excel layout template (layout name, caption and id). Also add Company Display name to the same table.
- Add a new report trigger OnPreRendering to handle additional platform processing of the generated report artifact.
- Add a new report property TargetFormat that gets the current output format.
- Fixed a problem with multiple sheet Microsoft Excel layout generation, when root DataItems had names containing special or whitespace characters (Excel required table repairs before the workbook could open).
HttpClient
- Added the
UseServerCertificateValidationproperty to the HttpClient data type to selectively disable server certificate validation on HTTP requests. Default value is true.
Miscellaneous
- Added SetAutoCalcFields on the RecordRef data type.
- Deprecated Debugger.EnableSqlTrace
- When the
AddTextorReadmethods are used on a non-assignable target of typeBigText, the produced values will be discarded instead of causing a crash. - Interfaces cannot contain methods whose signatures collide with the methods from the extended interfaces. It is also not possible to extend an interface with other interfaces whose methods collide.
- Allow having a dictionary where the value type is an interface.
- BCIdea Hovering over labels will additionally reveal if they are locked. Enums will show ordinal values. Codeunit hover text will contain the subtype (if it is a test or install codeunit etc.) and if it is a single instance.
- BCIdea Support modification of
CardPageIDonPageExtensions. If the property is already specified on the base page, the value in thePageExtensionwill override it. If multiplePageExtensions modify the property, the last extension to be applied will take effect. - BCIdea Added ToText method to simple types (BigInteger, Boolean, Byte, Date, DateTime, Decimal, Duration, Guid, Integer, Time, Version) for simple conversion to text. Continue to use FORMAT for advanced formatting options.
- Added a new ValidateServerCertificate property in the launch.json file. Default value is true. When set to false the connection to the Business Central service will no longer validate the server endpoint certificate.
- BCIdea It is now possible to ‘Peek references’ by clicking CodeLenses
- CodeLens references
- OptimizeForTextSearch will now cause an error if used on non-normal tables or fields.
- Fixed an issue with «Publish Full Dependency For Active Project» where publishing would fail to use the correct port if a port was specified in the server URL in the
launch.jsonfile. - Fixed an issue where moved fields would cause an ambiguous reference error when used in TestFilters.
- When autocompleting overloads for methods, if all of them have the same deprecation reason, the description will contain it.
- Fixed issues with the «Implement Interface» codefixer. Methods with interfaces parameters are generated correctly. Variable/Parameters type casing is aligned to Pascal Case. Fully qualified names are only used if needed i.e. respecting namespace-declaration and using-statements.
- Fixed issue with deep structured code would cause StackOverflowException
- Added support to display the default value of boolean properties on hover and in IntelliSense suggestions.
- Actions that have the
RunObjectproperty specified will use the Caption, ToolTip, AboutText, and AboutTitle properties of the targeted application object if none of these properties are specified. In support of this, the ToolTip property has also been added to Reports. - It is now possible to specify layout on the GetUrl command.
- Fixed an issue where object IDs were not recommended with namespaces.
- Added support for getting the current callstack by using the following statement
callstack := SessionInformation.Callstack. - Fixed an issue where Rapid Application Development (RAD) publishing would break when workspace changes consisted only of deleted files.
- Continue keyword is now recommended by intellisense.
- New CodeCop rule AA0249 to warn about unused page field triggers.
Más información / More information:



Deja un comentario