BC Friday Tips #20 Sort your triggers in sequence

Happy #BCFridayTips for #msdyn365bc developers.
Sort your triggers in sequence.
When writing AL code, arrange triggers in their execution order.
Why?
โ ๐ฅ๐ฒ๐ฎ๐ฑ๐ฎ๐ฏ๐ถ๐น๐ถ๐๐. Makes it easier to follow the logic flow.
Example:
dataitem(SalesShipmentLine; "Sales Shipment Line")
{
trigger OnPreDataItem()
begin
//do something
end;
trigger OnAfterGetRecord()
begin
//do something
end;
trigger OnPostDataItem()
begin
//do something
end;
}
This wonโt change performance, but it will make your code clearer for others.