Hi, Readers.
Today I would like to talk about how to get all dependent packages for the extension.
As you might know, when we develop for Business Central, we need to download the symbol files first. These contain the source code of the standard functions.

But if we want to extend other extensions, the default symbol files will not meet our needs. We need to add dependencies settings in the app.json file. For example,

After running the Download symbols command again, you can download their app files.

More details: App.json file
Setting | Mandatory | Value |
---|---|---|
dependencies | No | List of dependencies for the extension package. For example: "dependencies": [ {"id": "00001111-aaaa-2222-bbbb-3333cccc4444", "name": "WeatherLibrary", "publisher": "Microsoft", "version": "1.0.0.0"},{}] .Note: For dependencies to the System Application and Base Application, these are no longer listed as explicit dependencies, but captured in the application setting as a reference to the application package. They must have a version number of the Application package. See application below.Note: The version specified defines the minimum version for the dependency. At runtime and when downloading symbols, the latest version of the dependency satisfying the specified name, publisher and, minimum version is returned. When runtime is set to 4.0 or earlier, use appId instead of id . |
The same goes for standard apps, such as “SAF-T”.

So can we get dependencies setting from the code? For example, I want to check what extensions an installed extension depends on within BC. Yes, we can combine the following two methods to get the result.
- NavApp.GetModuleInfo(Guid, var ModuleInfo) Method: Gets information about the specified AL application.
- ModuleInfo.Dependencies() Method: Gets the collection of application dependencies.
Let’s see more details.
First of all, Extension Management page cannot be extended, so we need to create a new page that displays all extensions.

The application object or method ‘Extension Management’ has scope ‘OnPrem’ and cannot be used for ‘Cloud’ development. AL AL0296

We can use table 2000000153 “NAV App Installed App”:

More details: How to list all installed extensions/apps in your Business Central environment (Including hidden apps – “_Exclude_……”)
For example,

Then add a action to get the dependencies of the selected extension.



Another example:


Great.

Very simple, give it a try!!!😁
Source code: Github (Please note that the source code is for reference only, you can improve it according to your own needs)
page 50106 "Installed Apps"
{
ApplicationArea = All;
Caption = 'Installed Apps';
PageType = List;
SourceTable = "NAV App Installed App";
UsageCategory = Lists;
Editable = false;
InsertAllowed = false;
layout
{
area(Content)
{
repeater(General)
{
field(Name; Rec.Name)
{
ToolTip = 'Specifies the name of the extension.';
}
field(Publisher; Rec.Publisher)
{
ToolTip = 'Specifies the value of the Publisher field.', Comment = '%';
}
field(Version; VersionNo)
{
ToolTip = 'Specifies the value of the Version field.', Comment = '%';
}
field("Published As"; Rec."Published As")
{
ToolTip = 'Specifies the value of the Published As field.', Comment = '%';
}
}
}
}
actions
{
area(Processing)
{
action(ShowDependencies)
{
ApplicationArea = All;
Caption = 'Show Dependencies';
Promoted = true;
PromotedCategory = Process;
Image = ShowChart;
trigger OnAction()
var
InstalledApp: Record "NAV App Installed App";
Info: ModuleInfo;
ModuleDependencyInfo: ModuleDependencyInfo;
AllDependencies: Text;
begin
InstalledApp.Reset();
CurrPage.SetSelectionFilter(InstalledApp);
if InstalledApp.FindFirst() then begin
AllDependencies := '';
NavApp.GetModuleInfo(Rec."App ID", Info);
foreach ModuleDependencyInfo in Info.Dependencies do
if ModuleDependencyInfo.Name <> 'Application' then
AllDependencies := AllDependencies + ModuleDependencyInfo.Name + '\';
end;
if AllDependencies <> '' then
Message(AllDependencies)
else
Message('No dependencies found');
end;
}
}
}
var
VersionNo: Text[30];
trigger OnAfterGetRecord()
begin
VersionNo := Format(Rec."Version Major") + '.' + Format(Rec."Version Minor") + '.' + Format(Rec."Version Build") + '.' + Format(Rec."Version Revision");
end;
}
3. Dynamics 365 Business Central: How to quickly get the extension/app name from App ID in AL
END
Hope this will help.
Thanks for reading.
ZHU
コメント