Skip to content

Add namespace declarations, fix Code[250] return type, Access=Internal, and AL style in upgrade extension examples#3563

Closed
jeffreybulanadi wants to merge 3 commits into
MicrosoftDocs:mainfrom
jeffreybulanadi:fix-code-examples-real-patterns
Closed

Add namespace declarations, fix Code[250] return type, Access=Internal, and AL style in upgrade extension examples#3563
jeffreybulanadi wants to merge 3 commits into
MicrosoftDocs:mainfrom
jeffreybulanadi:fix-code-examples-real-patterns

Conversation

@jeffreybulanadi

Copy link
Copy Markdown
Contributor

Summary

Fixes namespace declarations, return types, Access properties, and AL style in upgrade codeunit examples.

Changes

  • Added namespace Contoso.ABCShoeExtension; to ABC Upgrade Shoe Size, ABC Upgrade Tag Definitions, InstallCodeunit
  • Added namespace Contoso.MyExtension; to preconditions example
  • Fixed GetABCShoeSizeUpgradeTag(): Text -> Code[250] (HasUpgradeTag/SetUpgradeTag take Code[250])
  • Added Access = Internal to all upgrade/install codeunits
  • Added using Microsoft.Sales.Customer; and using System.Upgrade; where needed
  • Fixed trigger semicolons, spacing, error() -> Error(), Subtype spacing
  • Added TIP note linking to real SalesForecastUpgrade.Codeunit.al

Source verification

  • ALAppExtensions/Apps/W1/SalesAndInventoryForecast/app/src/codeunits/SalesForecastUpgrade.Codeunit.al
  • ALAppExtensions/Apps/W1/ReviewGLEntries/app/src/codeunits/Upgrade.Codeunit.al

…e[250], add Access=Internal

- Add namespace Contoso.ABCShoeExtension to ABC Upgrade Shoe Size, ABC Upgrade Tag Definitions, InstallCodeunit
- Add namespace Contoso.MyExtension to MyUpgradeCodeunit preconditions example
- Fix GetABCShoeSizeUpgradeTag return type: Text -> Code[250] (HasUpgradeTag/SetUpgradeTag take Code[250])
- Add Access = Internal to all non-template codeunits (upgrade/install codeunits should not be public)
- Add using Microsoft.Sales.Customer and using System.Upgrade where needed
- Fix Subtype=Upgrade -> Subtype = Upgrade (AL spacing convention)
- Remove erroneous trailing semicolons from trigger declarations
- Fix error() -> Error() (built-in procedure capitalization)
- Fix myInfo : ModuleInfo -> myInfo: ModuleInfo (AL variable spacing)
- Add TIP note linking to real SalesForecastUpgrade.Codeunit.al in microsoft/ALAppExtensions
Source: ALAppExtensions/Apps/W1/SalesAndInventoryForecast/app/src/codeunits/SalesForecastUpgrade.Codeunit.al
…e.Codeunit.al

Port actual production code from microsoft/ALAppExtensions instead of invented tutorial
code. Source: Apps/W1/SalesAndInventoryForecast/app/src/codeunits/SalesForecastUpgrade.Codeunit.al

- Remove fictional Customer.Shoesize field migration (ABC-1234 invented tag)
- Add real codeunit 1851 Sales Forecast Upgrade with namespace Microsoft.Inventory.InventoryForecast
- Real tag MS-474737-SalesForecastCustomerConsent-20230607
- Real HasUpgradeTag double-check pattern (database-scope '' + per-company)
- Add explanation of key patterns observed in the real code
- Link to ReviewGLEntries Upgrade.Codeunit.al for DataTransfer bulk migration pattern
@learn-build-service-prod

Copy link
Copy Markdown
Contributor

Learn Build status updates of commit 4b4a5fd:

✅ Validation status: passed

File Status Preview URL Details
dev-itpro/developer/devenv-upgrading-extensions.md ✅Succeeded

For more details, please refer to the build report.

@jeffreybulanadi jeffreybulanadi changed the title fix(devenv-upgrading-extensions): namespace declarations, Code[250] return type, Access=Internal, AL style Add namespace declarations, fix Code[250] return type, Access=Internal, and AL style in upgrade extension examples May 14, 2026
@learn-build-service-prod

Copy link
Copy Markdown
Contributor

Learn Build status updates of commit c96579e:

✅ Validation status: passed

File Status Preview URL Details
dev-itpro/developer/devenv-upgrading-extensions.md ✅Succeeded

For more details, please refer to the build report.

@learn-build-service-prod

Copy link
Copy Markdown
Contributor

Learn Build status updates of commit b01e510:

✅ Validation status: passed

File Status Preview URL Details
dev-itpro/developer/devenv-upgrading-extensions.md ✅Succeeded

For more details, please refer to the build report.

@jeffreybulanadi jeffreybulanadi force-pushed the fix-code-examples-real-patterns branch from b01e510 to e6cea1a Compare May 15, 2026 00:08
@learn-build-service-prod

Copy link
Copy Markdown
Contributor

Learn Build status updates of commit e6cea1a:

✅ Validation status: passed

File Status Preview URL Details
dev-itpro/developer/devenv-upgrading-extensions.md ✅Succeeded

For more details, please refer to the build report.

@SusanneWindfeldPedersen SusanneWindfeldPedersen added the investigating Used when the issue needs to be further investigated. label May 19, 2026
@SusanneWindfeldPedersen

Copy link
Copy Markdown
Contributor

@jeffreybulanadi - thanks for your contribution. The PR has been reviewed with a developer and it fixes obvious errors, but we don't want to change the upgrade logic in the example, which is made (simple) for pedagogical reasons. I will close this PR, and take in the suggested error fixes in a different branch. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

investigating Used when the issue needs to be further investigated.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants