Skip to content

Add namespace declarations, DataClassification, Access=Internal, and AL style fixes to extension example#3564

Merged
SusanneWindfeldPedersen merged 1 commit into
MicrosoftDocs:mainfrom
jeffreybulanadi:fix-extension-example-namespace
May 19, 2026
Merged

Add namespace declarations, DataClassification, Access=Internal, and AL style fixes to extension example#3564
SusanneWindfeldPedersen merged 1 commit into
MicrosoftDocs:mainfrom
jeffreybulanadi:fix-extension-example-namespace

Conversation

@jeffreybulanadi

Copy link
Copy Markdown
Contributor

Summary

Fixes all AL code blocks in the Getting Started extension example so examples compile correctly and follow current AL best practices (namespaces, DataClassification, Access modifiers).

Changes in devenv-extension-example.md

Namespace declarations (7 objects)

All complete AL object definitions now include namespace Contoso.Rewards; as required since AL v24. Objects fixed: table 50100 Reward, page 50101 Reward Card, page 50102 Reward List (both occurrences), tableextension 50103 Customer Ext, pageextension 50104 Customer Card Ext, codeunit 50105 RewardsInstallCode, codeunit 50106 RewardsUpgradeCode.

Where objects reference types from other modules, using directives added:

  • using Microsoft.Sales.Customer; on tableextension and pageextension
  • This is required for the Customer record reference to resolve

DataClassification fixes

The table had DataClassification = ToBeClassified; (triggers AppSourceCop warning AA0240). All fields now have explicit DataClassification = CustomerContent;:

Field Before After
table 50100 (table-level) ToBeClassified CustomerContent
field 1 Reward ID ToBeClassified CustomerContent
field 2 Description missing CustomerContent
field 3 Discount Percentage missing CustomerContent
tableext field Reward ID missing CustomerContent

Source: ALAppExtensions/Apps/W1/ReviewGLEntries/app/src/tables/GLEntryReviewSetup.Table.al — real table with explicit DataClassification on all fields.

Access = Internal on install/upgrade codeunits

Added Access = Internal; to RewardsInstallCode and RewardsUpgradeCode. These codeunits are invoked by the platform at install/upgrade time, not by other AL code. Exposing them as Public (default) is unnecessary and misleading.

Source: Every upgrade/install codeunit in microsoft/ALAppExtensions uses Access = Internal.

Syntax fixes

  • Missing semicolon on Error('Cannot update the rewards status of a blocked customer.') — AL requires ; at end of statements
  • Removed trailing ; from trigger declarations: trigger OnValidate();trigger OnValidate(), etc. (AL triggers don't use semicolon)

Source verification

  • Namespace/using pattern: All namespaced AL objects in microsoft/ALAppExtensions
  • DataClassification: ALAppExtensions/Apps/W1/ReviewGLEntries/app/src/tables/GLEntryReviewSetup.Table.al
  • Access = Internal pattern: ALAppExtensions/Apps/W1/LatePaymentPredictor/app/src/LatePaymentInstall.Codeunit.al

…cess=Internal, fix semicolon

All complete AL object definitions now include namespace Contoso.Rewards and using
directives, matching real production patterns from microsoft/ALAppExtensions.

Objects updated:
- table 50100 Reward: namespace + DataClassification = CustomerContent on all fields
  (was ToBeClassified on field 1 Reward ID, missing on fields 2-3)
- page 50101 Reward Card: namespace
- page 50102 Reward List (both occurrences): namespace
- tableextension 50103 Customer Ext: namespace + using Microsoft.Sales.Customer
  + DataClassification = CustomerContent on Reward ID field
  + fixed missing semicolon on Error() call
  + fixed trigger OnValidate(); -> OnValidate() (no trailing semicolon)
- pageextension 50104 Customer Card Ext: namespace + using Microsoft.Sales.Customer
- codeunit 50105 RewardsInstallCode: namespace + Access = Internal
  + fixed trigger OnInstallAppPerCompany(); -> OnInstallAppPerCompany()
- codeunit 50106 RewardsUpgradeCode: namespace + Access = Internal
  + fixed trigger OnUpgradePerCompany(); -> OnUpgradePerCompany()

Source patterns from:
  ALAppExtensions/Apps/W1/ReviewGLEntries/app/src/tables/GLEntryReviewSetup.Table.al
  ALAppExtensions/Apps/W1/LatePaymentPredictor/app/src/LatePaymentInstall.Codeunit.al
@learn-build-service-prod

Copy link
Copy Markdown
Contributor

Learn Build status updates of commit 4995323:

✅ Validation status: passed

File Status Preview URL Details
dev-itpro/developer/devenv-extension-example.md ✅Succeeded

For more details, please refer to the build report.

@jeffreybulanadi jeffreybulanadi changed the title fix(devenv-extension-example): namespace declarations, DataClassification, Access=Internal, AL style fixes Add namespace declarations, DataClassification, Access=Internal, and AL style fixes to extension example May 14, 2026
@jeffreybulanadi jeffreybulanadi force-pushed the fix-extension-example-namespace branch from 4995323 to b9cbd5f Compare May 15, 2026 00:08
@learn-build-service-prod

Copy link
Copy Markdown
Contributor

Learn Build status updates of commit b9cbd5f:

✅ Validation status: passed

File Status Preview URL Details
dev-itpro/developer/devenv-extension-example.md ✅Succeeded

For more details, please refer to the build report.

@jeffreybulanadi jeffreybulanadi force-pushed the fix-extension-example-namespace branch from b9cbd5f to 9b7a026 Compare May 15, 2026 00:11
@learn-build-service-prod

Copy link
Copy Markdown
Contributor

Learn Build status updates of commit 9b7a026:

✅ Validation status: passed

File Status Preview URL Details
dev-itpro/developer/devenv-extension-example.md ✅Succeeded

For more details, please refer to the build report.

@SusanneWindfeldPedersen

Copy link
Copy Markdown
Contributor

Thanks for your contribution, much appreciated

@SusanneWindfeldPedersen SusanneWindfeldPedersen merged commit 87c2212 into MicrosoftDocs:main May 19, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants