community postAL Developmentcommunity - not Microsoftreviewed - checked by Opus

Managing Optional Extensions in Business Central AL Code

This post explains how to create a single Business Central extension that optionally interacts with a third-party extension without creating a hard dependency. The technique uses NavApp.GetModuleInfo to detect if an optional extension is installed, then uses RecordRef and FieldRef to conditionally set extension-specific fields.

post Aardvark Labs

Marcel Chabot · 2025-12-19 · 478 words · about 2 min

Key points

  • Call NavApp.GetModuleInfo with the optional extension’s app ID to find out at runtime whether it is installed
  • Split the journal creation into a core insert and a separate step for the fields from the optional extension
  • Use RecordRef and FieldRef with field numbers taken from page inspection to set those fields without a dependency
  • Check that each FieldRef is active before giving it a value, then modify the record through the RecordRef
  • With no dependency declared in app.json, one app runs on systems with or without the third-party extension

AL objects mentioned

As named in the post. A name that matches one object page by exact type and name links to it; the others stay as named.

Not found in BC28-30: table “TMG_EntityCashTransfer”.

Context

  • Features: optional extension detection, runtime field mapping, conditional field updates, extension GUID checking, module info retrieval

Source: Aardvark Labs, community blog. Summary, key points and quotes are derived (CONTENT-NOTICE.md); read the original for the full text.