-
Notifications
You must be signed in to change notification settings - Fork 692
[Event Requet] Table 60 "Document Sending Profile".SendToEMail #29806
Copy link
Copy link
Closed
Labels
missing-infoThe issue misses information that prevents it from completion.The issue misses information that prevents it from completion.
Description
Why do you need this change?
We need change values before sendemail.
Describe the request
local procedure SendToEMail(ReportUsage: Enum "Report Selection Usage"; RecordVariant: Variant; DocNo: Code[20]; DocName: Text[150]; ToCust: Code[20]; DocNoFieldNo: Integer)
var
Customer: Record Customer;
ElectronicDocumentFormat: Record "Electronic Document Format";
ReportSelections: Record "Report Selections";
DataCompression: Codeunit "Data Compression";
DocumentMailing: Codeunit "Document-Mailing";
ReportDistributionManagement: Codeunit "Report Distribution Management";
EmailBodyTempBlob: Codeunit "Temp Blob";
TempBlob: Codeunit "Temp Blob";
TypeHelper: Codeunit "Type Helper";
SourceReference: RecordRef;
ShowDialog: Boolean;
AttachmentStream: Instream;
SourceIDs: List of [Guid];
SourceRelationTypes,
SourceTableIDs : List of [Integer];
ClientFilePath: Text[250];
ClientZipFileName: Text[250];
SendToEmailAddress: Text[250];
begin
if "E-Mail" = "E-Mail"::No then
exit;
ShowDialog := "E-Mail" = "E-Mail"::"Yes (Prompt for Settings)";
// ------------------------------------------------- OnBeforeSendToEMail:BEGIN
OnBeforeSendToEMail(Rec, ReportUsage, RecordVariant, DocNo, DocName, ToCust, DocNoFieldNo, ShowDialog, ReportSelections);
// ------------------------------------------------- OnBeforeSendToEMail:END
case "E-Mail Attachment" of
"E-Mail Attachment"::PDF:
ReportSelections.SendEmailToCust(ReportUsage.AsInteger(), RecordVariant, DocNo, DocName, ShowDialog, ToCust);
"E-Mail Attachment"::"Electronic Document":
begin
ReportSelections.GetEmailBodyForCust(EmailBodyTempBlob, ReportUsage, RecordVariant, ToCust, SendToEmailAddress);
ReportDistributionManagement.SendXmlEmailAttachment(
RecordVariant, "E-Mail Format", EmailBodyTempBlob, SendToEmailAddress, ReportUsage);
end;
"E-Mail Attachment"::"PDF & Electronic Document":
begin
ElectronicDocumentFormat.SendElectronically(TempBlob, ClientFilePath, RecordVariant, "E-Mail Format");
ReportDistributionManagement.CreateOrAppendZipFile(DataCompression, TempBlob, ClientFilePath, ClientZipFileName);
ReportSelections.SendToZipForCust(ReportUsage, RecordVariant, DocNo, ToCust, DataCompression);
DataCompression.SaveZipArchive(TempBlob);
TempBlob.CreateInStream(AttachmentStream);
TypeHelper.CopyRecVariantToRecRef(RecordVariant, SourceReference);
SourceTableIDs.Add(SourceReference.Number());
SourceIDs.Add(SourceReference.Field(SourceReference.SystemIdNo).Value());
SourceRelationTypes.Add(Enum::"Email Relation Type"::"Primary Source".AsInteger());
if Customer.Get(ToCust) then begin
SourceTableIDs.Add(Database::Customer);
SourceIDs.Add(Customer.SystemId);
SourceRelationTypes.Add(Enum::"Email Relation Type"::"Related Entity".AsInteger());
end;
ReportSelections.GetEmailBodyForCust(EmailBodyTempBlob, ReportUsage, RecordVariant, ToCust, SendToEmailAddress);
DocumentMailing.EmailFile(
AttachmentStream, ClientZipFileName, EmailBodyTempBlob, DocNo, SendToEmailAddress, DocName,
not ShowDialog, ReportUsage.AsInteger(), SourceTableIDs, SourceIDs, SourceRelationTypes);
end;
end;
OnAfterSendToEMail(Rec, ReportUsage, RecordVariant, DocNo, DocName, ToCust, DocNoFieldNo, ShowDialog);
end;
// ------------------------------------------------- OnBeforeSendToEMail:BEGIN
[IntegrationEvent(false, false)]
local procedure OnBeforeSendToEMail(var DocumentSendingProfile: Record "Document Sending Profile"; ReportUsage: Enum "Report Selection Usage"; RecordVariant: Variant; DocNo: Code[20]; DocName: Text[150]; ToCust: Code[20]; DocNoFieldNo: Integer; var ShowDialog: Boolean; var ReportSelections: Record "Report Selections")
begin
end;
// ------------------------------------------------- OnBeforeSendToEMail:END
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
missing-infoThe issue misses information that prevents it from completion.The issue misses information that prevents it from completion.