While Business Central accommodates an oversized style of records and transactions, shoppers typically wish for extra fields, tables, and custom business logic. Developers produce extensions to feature this practicality to Business Central. Developing basics for Business Central and a few issues area units mentioned during this article.
Pages and Page Extensions – They show the underlying table knowledge. just like the Table Extension, the Page Extension is employed to switch pages that exist already in Business Central. Pages usually manifest as Lists and Cards. Lists show general data for several records, whereas the cardboard can show a lot of detail for one record. elements area unit pages that may be embedded into different pages. as an example, the Sales Order maybe a card for the header detail, and therefore the Sales Order Subform may be a half that displays every one of the Sales Lines of that elected Sales Header.
Factboxes typically seem on pages as a right-pane that gives supplemental data for the chosen record. One Factbox is utilized in multiple pages presumptuous they’re suitably connected to the record provides the knowledge.
Whereas procedures are created on the table and page level to feature business logic, Codeunits separate practicality and permit for A level of encapsulation to a developer’s code.
Reports comprise a dataset and a minimum of one layout. The Dataset relates records and prompts for filter inputs. The Layout is either RDLC or a Word layout.
Like report datasets, queries offer data on multiple connected records. These queries are deployed as SOAP/ODATA net services for automation and custom news.
With the information of the fundamental objects, there is a unit several best practices and considerations value characteristic before development commences.
It’s vital to spot if the extension is developed for an associate degree On-Premises or computer code as a Service (SaaS) shopper. On-Premises need the acquisition and allocation of objects (e.g. Table Data, Code Units) before the extension is deployed to production. A developer license is important for the appliance readying (as well as putting in a laborer Image for the test). The computer code as a Service variant of Business Central doesn’t presently have this demand.
Users should take steps to forestall collisions with different extensions. additionally, to the thing ID (a variety range), the thing Name should be distinctive per extension. Currently, partners will reserve prefix and suffix letters to forestall collision (MS Documentation here).
Whereas their area unit whispers of Object Range obsoletion down the road, these numerical values area unit a sort of symbol for all objects (tables, pages, etc.). the thing Ranges also are reserved supported the kind of extension (MS Documentation here). Customizations tailored per shopper can usually be fifty,000-99,999. In different words, I might use Table Object fifty,100 for the instrumentation table, or Table Extension.
Job Queues and integrations come back screeching to a halt their area unit program prompts and messages. Special care ought to be taken to confirm that such UI is bypassed. The HideDialog bool is usually adscititious as a parameter to world procedures and passed to the connected native procedures for this reason.
While AL isn’t a fully-fledged Object-Oriented Programming (OOP) language, there area unit some effective OOP principles that ought to be mirrored in extension development.
Encapsulation is that the combination of procedures to limit the direct access to object parts. rather than making one large procedure directly on a Table or Page that handles all business logic, the procedure ought to instead decision a writing unit that handles the work. These procedures are going to be native to limit direct access and mutation of the extension. That code unit can comprise the worldwide procedure referred to as from the table/page also as a series of native procedures that perform the subsequent operations.
This can be the compartmentalization of code such as associate degree update in one section doesn’t need a modification in another section. As mentioned in Encapsulation, it’s common to visualize a procedure on a Page or Table that invokes another procedure from a separate code unit to perform the business logic. By rending this out, developers will build additional changes to the business logic within the writing unit while not essentially dynamic the procedure on the Table or Page.
It’s the flexibility to increase code while not having to start out from scratch. Business Central has Integration and Business Events to that a user will subscribe add code before or when bound procedures. they’re systematically prefixed with OnBefore and OnAfter, and that they are going to be invoked before and when the method(s) that perform the most business logic. constant events are created in extensions.
When designed properly, the OnBefore events also can bypass most procedures by setting the bool, Handled, to true. because of multiple applications and customizations will exist on one Business Central tenant, extensibility is very vital. making Business and Integration Events can permit developers to interface with one another’s code while not essentially having full access to the ASCII text file.
Best practices and issues area unit mirrored during this generic example. From a page or table, a world procedure, SomeProc, is invoked from a codeunit variable. Amongst its parameters is that the HideDialog bool, which determines if the program can interact with prompts and messages.
The subsequent pattern describes a world procedure, SomeProc, that may be referred to as outwardly from a page or table. HideDialog and different parameters area unit passed to the current procedure.
ConfirmSomeProc prompts the shopper to continue with the overall technique, and AckSomeProc shows a triumph message because of the last advance of SomeProc.
With the OnBeforeSomeProc, engineers will empower the handled bool to sidestep DoSomeProc, or they will leave the bool phony to proceed to the primary explanation created within the arrangement.
The initial section of the DoSomeProc ought to exist if the handled bool is ready to be valid.