Is this the most stupid thing in AL coding?

samantha73samantha73 Member Posts: 96
Well, I've been pulling my hair out trying to figure out how to pass a parameter to a code unit and the way NAV/BC does this is not intuitive at all. here's an example from Github
https://github.com/microsoft/AL/issues/3845

Quote
"Teaching AL development to an experienced outside developer is an many aspects interesting. Just take this topic.

So he starts programming a codeunit object in AL like this:

codeunit 66666 MyCodeunit
{
trigger OnRun()
begin

end;
}
And now he would like to add a parameter to the OnRun trigger. What is the most intuitive way to do that? What would be most logic for any non-NAV developer to do that?
Right, like adding a parameter to any function. Place your cursor in between the bracket and start typing:

codeunit 66666 MyCodeunit
{
trigger OnRun(var Rec : Record "My Table")
begin

end;
}
Indeed, VSCode will error telling that this is a wrong signature. All NAV developers know you have to define the TableNo property (well, I even dare to argue that):

codeunit 66666 MyCodeunit
{
TableNo = "My Table";

trigger OnRun( )
begin

end;
}"

seriously how hard can it be?

Answers

Sign In or Register to comment.