diff --git a/src/System Application/App/Email/src/Email/Email.Codeunit.al b/src/System Application/App/Email/src/Email/Email.Codeunit.al index 1e8b55a9db..7d5b095411 100644 --- a/src/System Application/App/Email/src/Email/Email.Codeunit.al +++ b/src/System Application/App/Email/src/Email/Email.Codeunit.al @@ -651,6 +651,16 @@ codeunit 8901 Email begin end; + /// + /// Integration event that allows overriding the filtering of related source records before they are shown. + /// + /// The related source records to filter. Subscribers can apply their own filtering, for example to ignore security filtering when determining read permission. + /// Out parameter to set if the event was handled. If set to true, the default filtering is skipped. + [IntegrationEvent(false, false)] + internal procedure OnBeforeFilterRemovedSourceRecords(var EmailRelatedRecord: Record "Email Related Record"; var IsHandled: Boolean) + begin + end; + /// /// Integration event to add additional relations based on added relation to emails. /// diff --git a/src/System Application/App/Email/src/Email/EmailImpl.Codeunit.al b/src/System Application/App/Email/src/Email/EmailImpl.Codeunit.al index e275ad0ac1..23ebcab7b1 100644 --- a/src/System Application/App/Email/src/Email/EmailImpl.Codeunit.al +++ b/src/System Application/App/Email/src/Email/EmailImpl.Codeunit.al @@ -745,8 +745,14 @@ codeunit 8900 "Email Impl" procedure FilterRemovedSourceRecords(var EmailRelatedRecord: Record "Email Related Record") var AllObj: Record AllObj; + Email: Codeunit Email; SourceRecordRef: RecordRef; + IsHandled: Boolean; begin + Email.OnBeforeFilterRemovedSourceRecords(EmailRelatedRecord, IsHandled); + if IsHandled then + exit; + repeat if AllObj.Get(AllObj."Object Type"::Table, EmailRelatedRecord."Table Id") then begin SourceRecordRef.Open(EmailRelatedRecord."Table Id");