diff --git a/src/System Application/App/AI/src/Azure OpenAI/AzureOpenAI.Codeunit.al b/src/System Application/App/AI/src/Azure OpenAI/AzureOpenAI.Codeunit.al index 5c590629c0..7992af7d3f 100644 --- a/src/System Application/App/AI/src/Azure OpenAI/AzureOpenAI.Codeunit.al +++ b/src/System Application/App/AI/src/Azure OpenAI/AzureOpenAI.Codeunit.al @@ -52,10 +52,11 @@ codeunit 7771 "Azure OpenAI" /// True if API and capability is enabled for environment. procedure IsEnabled(CopilotCapability: Enum "Copilot Capability"; Silent: Boolean; AppId: Guid): Boolean var - CallerModuleInfo: ModuleInfo; + AppModuleInfo: ModuleInfo; begin - NavApp.GetModuleInfo(AppId, CallerModuleInfo); - exit(AzureOpenAIImpl.IsEnabled(CopilotCapability, Silent, CallerModuleInfo)); + if not NavApp.GetModuleInfo(AppId, AppModuleInfo) then + exit(false); + exit(AzureOpenAIImpl.IsEnabled(CopilotCapability, Silent, AppModuleInfo)); end; ///