Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Business Event for Refresh Option and an API for it. #114

Merged
merged 1 commit into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions businessCentral/app/src/EnumTranslation.Table.al
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ table 82567 "ADLSE Enum Translation"
ADLSETable: Record "ADLSE Table";
ADLSEEnumTranslation: Record "ADLSE Enum Translation";
ADLSEEnumTranslationLang: Record "ADLSE Enum Translation Lang";
ADLSESetupRec: Record "ADLSE Setup";
RecordField: Record Field;
ADLSEExternalEvents: Codeunit "ADLSE External Events";
ADLSERecordRef: RecordRef;
begin
ADLSEEnumTranslation.DeleteAll();
Expand All @@ -80,6 +82,8 @@ table 82567 "ADLSE Enum Translation"
ADLSETable.Add(ADLSEEnumTranslationLang.RecordId.TableNo);
ADLSETable.AddAllFields();
end;

ADLSEExternalEvents.OnRefreshOptions(ADLSESetupRec);
end;

local procedure InsertEnums(ADLSERecordRef: RecordRef; FieldRec: Record Field)
Expand Down
16 changes: 16 additions & 0 deletions businessCentral/app/src/ExternalEvents.Codeunit.al
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,17 @@ codeunit 82574 "ADLSE External Events"
MyBusinessOnExportFinished(ADLSESetup.SystemId, ADLSESetup."Storage Type", Url, WebClientUrl);
end;

internal procedure OnRefreshOptions(ADLSESetup: Record "ADLSE Setup")
var
Url: Text[250];
WebClientUrl: Text[250];
ADLSEFieldApiUrlTok: Label 'bc2adlsTeamMicrosoft/bc2adls/v1.0/companies(%1)/adlseSetup(%2)', Locked = true;
begin
Url := ADLSEExternalEventsHelper.CreateLink(ADLSEFieldApiUrlTok, ADLSESetup.SystemId);
WebClientUrl := CopyStr(GetUrl(ClientType::Web, CompanyName(), ObjectType::Page, Page::"ADLSE Setup", ADLSESetup), 1, MaxStrLen(WebClientUrl));
MyBusinessOnRefreshOptions(ADLSESetup.SystemId, ADLSESetup."Storage Type", Url, WebClientUrl);
end;

local procedure GetSetup()
var
ADLSESetup: Record "ADLSE Setup";
Expand Down Expand Up @@ -186,6 +197,11 @@ codeunit 82574 "ADLSE External Events"
begin
end;

[ExternalBusinessEvent('OnRefreshOptions', 'Refresh Options', 'When the options are refreshed', EventCategory::ADLSE)]
local procedure MyBusinessOnRefreshOptions(SystemId: Guid; "Storage Type": Enum "ADLSE Storage Type"; Url: Text[250]; WebClientUrl: Text[250])
begin
end;

[EventSubscriber(ObjectType::Table, Database::"ADLSE Table", OnAfterResetSelected, '', true, true)]
local procedure OnAfterResetSelected(ADLSETable: Record "ADLSE Table");
begin
Expand Down
9 changes: 9 additions & 0 deletions businessCentral/app/src/SetupAPIv11.Page.al
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,15 @@ page 82568 "ADLSE Setup API v11"
SetActionResponse(ActionContext, Rec."SystemId");
end;

[ServiceEnabled]
procedure RefreshOptions(var ActionContext: WebServiceActionContext)
var
ADLSEEnumTranslation: Record "ADLSE Enum Translation";
begin
ADLSEEnumTranslation.RefreshOptions();
SetActionResponse(ActionContext, Rec."SystemId");
end;

local procedure SetActionResponse(var ActionContext: WebServiceActionContext; AdlsId: Guid)
var
begin
Expand Down
Loading