When creating your AL project (and your .al files), remember to always follow these main guidelines.
Inside a .al code file, the structure for all your objects must follow this sequence:
- Properties
- Object-specific constructs:
- Table fields
- Page layout
- Actions
- Global variables:
- Labels (old text constants)
- Global variables
- Methods
Remember to always reference the AL objects by their object name and not by their ID. So, for example, this is how you reference a Record variable or a Page variable:
Vendor: Record Vendor;
Page.RunModal(Page::"Customer Card", ...);
In an event subscriber object, this is how you should reference the publisher object:
[EventSubscriber(ObjectType::Codeunit, Codeunit::MyCodeunit, 'MyIntegrationEvent', '', false, false)]
local procedure MyIntegrationEventSubscriber()
begin
end;
So, let's...