If you are talking about the emailing a invoice as a PDF and how to change the name of the PDF file then take a look at "Document-Mailing" code unit and its Text Constance.
These functions are called from
EmailRecords(ShowRequestForm : Boolean)
SendRecords(ShowRequestForm,TRUE);
LOCAL SendRecords(ShowRequestForm : Boolean;SendAsEmail : Boolean)
WITH SalesInvoiceHeader DO BEGIN
COPY(Rec);
ReportSelections.SETRANGE(Usage,ReportSelections.Usage::"S.Invoice");
ReportSelections.SETFILTER("Report ID",'<>0');
ReportSelections.FIND('-');
REPEAT
IF NOT SendAsEmail THEN
REPORT.RUNMODAL(ReportSelections."Report ID",ShowRequestForm,FALSE,SalesInvoiceHeader)
ELSE
SendReport(ReportSelections."Report ID",SalesInvoiceHeader)
UNTIL ReportSelections.NEXT = 0;
END;
LOCAL SendReport(ReportId : Integer;VAR SalesInvoiceHeader : Record "Sales Invoice Header")
ServerAttachmentFilePath := COPYSTR(FileManagement.ServerTempFileName('pdf'),1,250);
REPORT.SAVEASPDF(ReportId,ServerAttachmentFilePath,SalesInvoiceHeader);
COMMIT;
DocumentMailing.EmailFileFromSalesInvoiceHeader(SalesInvoiceHeader,ServerAttachmentFilePath);
And in the Document-Mailing code unit
EmailFileFromSalesInvoiceHeader(SalesInvoiceHeader : Record "Sales Invoice Header";AttachmentFilePath : Text[250])
EmailFile(AttachmentFilePath,
SalesInvoiceHeader."No.",
SalesInvoiceHeader."Bill-to Customer No.",
SalesInvoiceHeader."Bill-to Name",
InvoiceTxt);
And in that Text Constance have following
Name ConstValue
EmailSubjectCapTxt %1 - %2 %3
ReportAsPdfFileNameMsg Online Receipt %1 %2.pdf
InvoiceTxt Invoice
CrMemoTxt Credit Memos
And most importantly in this function NAV change the name of the PDF file
LOCAL EmailFile(AttachmentFilePath : Text[250];PostedDocNo : Code[20];SendEmaillToCustNo : Code[20];SendEmaillToCustName : Text[50];EmailDocName : Text[50])
AttachmentFileName := STRSUBSTNO(ReportAsPdfFileNameMsg,EmailDocName,PostedDocNo);
WITH TempEmailItem DO BEGIN
// recSMTP.GET;
//"From Address" := recSMTP."EMail Address";
"Send to" := GetToAddressFromCustomer(SendEmaillToCustNo);
Subject := COPYSTR(
STRSUBSTNO(
EmailSubjectCapTxt,SendEmaillToCustName,EmailDocName,PostedDocNo),1,
MAXSTRLEN(Subject));
"Attachment File Path" := AttachmentFilePath;
"Attachment Name" := AttachmentFileName;
Send(FALSE);
END;
If you change the AttachmentFileName then you will be able to change the fie name of the PDF file.
Hope you would get a idea.