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
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.
- table 81 “Gen. Journal Line”
- table “TMG_EntityCashTransfer”
Not found in BC28-30: table “TMG_EntityCashTransfer”.
Possibly related
No source states these links: they share an object, a model read them, or a person found the same subject.
- Allow Posting Date Formula — possibly related: both name Table 81 “Gen. Journal Line”
- Dynamics 365 Business Central: Regarding the issue where the Source Currency Amount in G/L Entry differs from the pre-posting Amount in BC27 — possibly related: both name Table 81 “Gen. Journal Line”
- How to Group and Consolidate General Journal Lines Using Query Object in Business Central. — possibly related: both name Table 81 “Gen. Journal Line”
- Tax Engine - Configuration of Tax Type and Tax Rates — possibly related: names Table 81 “Gen. Journal Line”
- View Temporary General Journal Balances in Switzerland — possibly related: names Table 81 “Gen. Journal Line”
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.