We now have the skeleton of a PTE, we just need to start configuring it, starting with the launch.json, this file tells VS code which server to connect to when we run it, you can have multiple configuration, for different languages or server locations.It will then ask you to select a server, choose the local option.It will ask you a target platform to select, at the time of writing Business Central 16 has just come out so the latest available platform is 5.0, if you want to create a PTE on BC15 select 4.0, BC14 3.0 etc etc.Hit Ctrl+Shift+P this will bring up the VS console, and type AL: Go! And select the option, it will bring up a location to save your project to, select a value and hit enter.To create a more in depth BC extension, with new tables, pages, and codeunits, you should be able to follow the Microsoft example, I will just outline a way of producing a very simple Per Tenant Extension. MESSAGE('Cannot use a plus sign (+) in the address ') Įxamples of our Events can be found in the Zetadocs Customize codeunit. In the example Subscriber below note how the method parameter matches the parameter from the Publisher event.ĮventSubscriberInstance = StaticAutomatic Look up the MSDN documentation for more information if you need it here. The rest of the values are less important and can usually be left to default values ‘’, false, false. the name of the publisher method, in our example this is, OnAddressLineChanged. the object that publishes the object, you can use the id or the name, so for example Codeunit::” MyPublishers” this is the type of object that’s publishing the event, so Codeunit, Page, Table. Decorate the method with the EventSubscriber attribute, see below.Add code to the method to handle the event.You must decide which codeunit to use for the event subscriber, either a new codeunit or an existing one.
In AL this is a method that subscribes to a specific publisher method and when raised runs its own code. Subscriber – listens for and handles a published event.This on its own does nothing, you still need to raise the event for a subscriber to respond. Publisher – this is the object that exposes the event to subscribers, this is where you want them to hook into.Event – Declared by an AL method, this is an event publisher function and is just a signature, it does not execute any code.net framework so should be quite familiar, they comprise of three parts:
The idea is that you can run customized code at certain points in the software using events, they’re based off the.
Once the dependency has been added, make sure to Download Symbols (in VS Code this is Ctrl+Shift+P and type AL: Download Symbols) "name": "Zetadocs Delivery and Zetadocs Capture", Microsoft have a very good walkthrough that a lot of this document will be referencing, and is certainly worth reading as a pre-requisite, it’s found here.Ī dependency on the Zetadocs Capture and Zetadocs Delivery Extension needs to be added to the App.json of the Per Tenant Extension, the following is a code snippet to do this, note the version should match the version of Zetadocs installed (this can be found by searching BC for Extensions):