Skip to content

Commit 0a4fb58

Browse files
Add namespace and using directives to AL code examples in business events and interfaces documentation
1 parent 9148534 commit 0a4fb58

2 files changed

Lines changed: 27 additions & 14 deletions

File tree

dev-itpro/developer/business-events-overview.md

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -176,31 +176,36 @@ To build and install an extension that implements custom business events, see ou
176176
1. Use the **Business Central Virtual Data Source Configuration** table to refresh the Business Central catalog with custom business events on your Dataverse environment (see [previous section](#refresh-business-central-catalog-of-business-events)).
177177

178178
```al
179+
namespace MyCompany.SalesExtension;
180+
181+
using System.Integration;
182+
using Microsoft.Sales.Document;
183+
179184
enumextension 50101 MyEnumExtension extends EventCategory
180185
{
181-
  value(0; "Sales")
182-
  {
183-
  }
186+
value(0; "Sales")
187+
{
188+
}
184189
}
185190
186-
codeunit 50102 MyCodeunit 
187-
{ 
188-
trigger OnRun()
191+
codeunit 50102 MyCodeunit
192+
{
193+
trigger OnRun()
189194
begin
190-
end; 
195+
end;
191196
192197
[ExternalBusinessEvent('salesorderposted', 'Sales order posted', 'Triggered when sales order has been posted', EventCategory::"Sales")]
193198
[RequiredPermissions(PermissionObjectType::TableData, Database::"Sales Header", 'R')] // optional
194-
   procedure SalesOrderPosted(salesOrderId: Guid; customerName: Text; orderNumber: Text)
195-
  begin
196-
   end;
199+
procedure SalesOrderPosted(salesOrderId: Guid; customerName: Text; orderNumber: Text)
200+
begin
201+
end;
197202
198-
[EventSubscriber(ObjectType::Page, Page::"Sales Order", 'OnPostDocumentBeforeNavigateAfterPosting', '', true, true)] 
199-
local procedure OnPostDocument(var SalesHeader: Record "Sales Header"; var PostingCodeunitID: Integer; var Navigate: Enum "Navigate After Posting"; DocumentIsPosted: Boolean; var IsHandled: Boolean) 
203+
[EventSubscriber(ObjectType::Page, Page::"Sales Order", 'OnPostDocumentBeforeNavigateAfterPosting', '', true, true)]
204+
local procedure OnPostDocument(var SalesHeader: Record "Sales Header"; var PostingCodeunitID: Integer; var Navigate: Enum "Navigate After Posting"; DocumentIsPosted: Boolean; var IsHandled: Boolean)
200205
begin
201-
SalesOrderPosted(SalesHeader.SystemId, SalesHeader."Sell-to Customer Name", SalesHeader."No."); 
206+
SalesOrderPosted(SalesHeader.SystemId, SalesHeader."Sell-to Customer Name", SalesHeader."No.");
202207
end;
203-
} 
208+
}
204209
```
205210

206211
## Query Business Central catalog of business events in non-Dataverse systems

dev-itpro/developer/devenv-interfaces-in-al.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ The following example defines an interface `IAddressProvider`, which has one met
6464
The `MyAddressPage` is a simple page with an action that captures the choice of address and calls, based on that choice, an implementation of the `IAddressProvider` interface.
6565

6666
```AL
67+
namespace MyCompany.AddressManagement;
68+
6769
interface "IAddressProvider"
6870
{
6971
procedure GetAddress(): Text
@@ -183,6 +185,10 @@ The [Dictionary](methods-auto/dictionary/dictionary-data-type.md) and [List](met
183185
The following example illustrates how to create a [Dictionary](methods-auto/dictionary/dictionary-data-type.md) of interfaces:
184186

185187
```AL
188+
namespace MyCompany.BarcodeExamples;
189+
190+
using System.Text;
191+
186192
codeunit 50120 MyDictionaryCodeunit
187193
{
188194
procedure MyProcedure(): Dictionary of [Integer, Interface "Barcode Font Provider"]
@@ -199,6 +205,8 @@ codeunit 50120 MyDictionaryCodeunit
199205
The following example illustrates how to create a [List](methods-auto/list/list-data-type.md) of interfaces:
200206

201207
```al
208+
namespace MyCompany.ShapeExamples;
209+
202210
interface IShape
203211
{
204212
procedure GetArea(): Decimal;

0 commit comments

Comments
 (0)