al-codeactions
al-codeactions copied to clipboard
"Create procedure" on Rec inside a page extension will create a function inside the page extension
If we use "Create procedure" on a non-existant procedure on the Rec
variable inside a page extension, the procedure is created inside the current page extension instead of the table extension or the base table.
pageextension 50034 "My Test" extends "Customer Card"
{
trigger OnOpenPage()
begin
Rec.Test123(); // executing "Create Procedure" here, will create the following procedure
end;
// Procedure should be created either as a procedure in
// tableextension (if available)
// or
// in the base table (if available)
internal procedure Test123()
begin
Error('Procedure Test123 not implemented.');
end;
internal procedure Foo()
var
Vendor: Record Vendor;
begin
Vendor.Test999(); // "Create Procedure" isn't shown (probably intentional)
end;
}
For "normal" records (last example in the code), we don't even get the "Create Procedure" action for unknown procedure names, so I assume this is intentional as I don't think it's that trivial to implement. If so, maybe you could also just disable to show the "Create procedure" on the Rec variable.
Yes, you're right. It's a bit more work to do, but I started with it already. Furthermore I have to take the NonImplicitWith Feature-Flag into account and also there could be multiple tableextensions in the same app in the future. That should also be considered directly then. And if there's no table extension yet, then what? Creating the tableextension? Don't know where to place it then and which id to take as maybe they're working with AL Object ID Ninja, or have a manual id registration tool or whatever.. So there are a few things to consider. But let's see where it ends :)