generated from microsoft/AL-Go-AppSource
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement generic per user report notifyier
- Loading branch information
1 parent
fd0f1ab
commit bf16574
Showing
5 changed files
with
82 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
MSDyn365BC.Ntfy/src/EventTypes/ReportFinishedProcessing/ReportFinishedProcessing.Codeunit.al
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
codeunit 71179883 ReportFinishedProcessingNTSTM implements INtfyEventNTSTM | ||
{ | ||
procedure SetSettings(NtfyEvent: Record NtfyEventNTSTM) | ||
var | ||
AllObjWithCaption: Record AllObjWithCaption; | ||
FilterPageBuilder: FilterPageBuilder; | ||
begin | ||
FilterPageBuilder.AddTable('Report List', Database::AllObjWithCaption); | ||
FilterPageBuilder.AddField('Report List', AllObjWithCaption."Object Type", 'Report'); | ||
FilterPageBuilder.AddField('Report List', AllObjWithCaption."Object ID"); | ||
if NtfyEvent.FilterText <> '' then | ||
FilterPageBuilder.SetView('Report List', NtfyEvent.FilterText); | ||
if FilterPageBuilder.RunModal() then begin | ||
if not FilterPageBuilder.GetView('Report List').Contains('WHERE') then | ||
NtfyEvent.Validate(FilterText, '') | ||
else | ||
NtfyEvent.Validate(FilterText, FilterPageBuilder.GetView('Report List')); | ||
NtfyEvent.Modify(true); | ||
end; | ||
end; | ||
|
||
procedure ResetSettings(NtfyEvent: Record NtfyEventNTSTM) | ||
begin | ||
NtfyEvent.Validate(FilterText, ''); | ||
NtfyEvent.Modify(true); | ||
end; | ||
|
||
procedure FilterNtfyEntriesBeforeBatchSend(var NtfyEvent: Record NtfyEventNTSTM; Params: Dictionary of [Text, Text]) | ||
begin | ||
end; | ||
|
||
procedure DoCallNtfyEvent(NtfyEvent: Record NtfyEventNTSTM; Params: Dictionary of [Text, Text]) ReturnValue: Boolean | ||
var | ||
FilterObjects: Record AllObj; | ||
begin | ||
ReturnValue := true; | ||
if NtfyEvent.FilterText <> '' then begin | ||
FilterObjects.SetView(NtfyEvent.FilterText); | ||
FilterObjects.FilterGroup(2); | ||
FilterObjects.SetRange("Object Type", FilterObjects."Object Type"::Report); | ||
FilterObjects.SetFilter("Object ID", Params.Get('ReportID')); | ||
ReturnValue := not FilterObjects.IsEmpty(); | ||
end; | ||
end; | ||
|
||
procedure GetMessage(NtfyEvent: Record NtfyEventNTSTM; Params: Dictionary of [Text, Text]) ReturnValue: Text[2048] | ||
var | ||
AllObjWithCaption: Record AllObjWithCaption; | ||
ReportCaption: Text[249]; | ||
ReportFinishedLbl: Label 'Report %1 (%2) finished processing', Comment = '%1 - Report Caption, %2 - Report ID'; | ||
begin | ||
AllObjWithCaption.SetRange("Object Type", AllObjWithCaption."Object Type"::Report); | ||
AllObjWithCaption.SetFilter("Object ID", Params.Get('ReportID')); | ||
AllObjWithCaption.SetLoadFields("Object Caption"); | ||
if AllObjWithCaption.FindFirst() then | ||
ReportCaption := AllObjWithCaption."Object Caption"; | ||
|
||
exit(StrSubstNo(ReportFinishedLbl, ReportCaption, Params.Get('ReportID'))); | ||
end; | ||
|
||
|
||
|
||
[EventSubscriber(ObjectType::Codeunit, Codeunit::ReportManagement, OnAfterDocumentReady, '', false, false)] | ||
local procedure SentNtfyOnAfterReleaseSalesDoc(ObjectID: Integer; var Success: Boolean) | ||
var | ||
NtfyEvent: Record NtfyEventNTSTM; | ||
Params: Dictionary of [Text, Text]; | ||
begin | ||
Params.Add('ReportID', Format(ObjectID)); | ||
NtfyEvent.SendNotifications(NtfyEvent.EventType::ReportFinishedProcessing, Params); | ||
end; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters