We won’t to modify the filename of the attached invoice :
But based on IFS documentation this can not be done
Is it possible threw configuration to disable the standard wat of sending email a implementing it with event or somethis else so we can be able to modify the object, body and attached filename please?
Unfortunately it’s not possible to change the filename or the message body when using the Email functionality in the report dialog. I had the requirement once for a customer and following is how I managed to do it using report rules for order confirmation. Hope it might help in your situation too.
Create a custom field in the customer order to mention the email which the order needs to be sent.
Created a report rule for CUSTOMER_ORDER_CONF_REP with action email to send the file to the email (email is fetched dynamically from the custom field above). Here you can define a custom email body, file name subject ...etc
Used the report rule condition PrinterId=PDF_PRINTER
User instructions: enter the email in the custom field and use the printer IFS PDF Archiver when they want to send the email
You can tweak the rule conditions and see what’s best for you :)
Unfortunately it’s not possible to change the filename or the message body when using the Email functionality in the report dialog. I had the requirement once for a customer and following is how I managed to do it using report rules for order confirmation. Hope it might help in your situation too.
Create a custom field in the customer order to mention the email which the order needs to be sent.
Created a report rule for CUSTOMER_ORDER_CONF_REP with action email to send the file to the email (email is fetched dynamically from the custom field above). Here you can define a custom email body, file name subject ...etc
Used the report rule condition PrinterId=PDF_PRINTER
User instructions: enter the email in the custom field and use the printer IFS PDF Archiver when they want to send the email
You can tweak the rule conditions and see what’s best for you :)
There’s really two different questions here. (Disabling the default Email, and changing an email body/subject/attachment filename).
@dsj ‘s method is best if you dont have access to PLSQL blocks and customizations, but if you do, here’s what you can do.
1: Disabling the standard “email” sent when you provide an email in the print dialog.
This is possible, it’s a bit convoluted but basically setting an SMTP_MAIL_ADDRESS against a user makes the mail_sender try to use that email address in the “from”, and typically the mail sender does not have send as privileges for that mailbox, so the email is effectively stopped dead in its track (the application message is created, but the email never sends as the exchange server replies that the mail sender account does not have send as privileges on the user’s mailbox)
In cloud this is done by setting an email in this field:
You can then create a PLSQL Online Event Action that triggers when the PDF is generated (this is on event ID PDF_REPORT_CREATED). Preferable if you execute it as a deferred job to be able to track if anything goes wrong etc.
In this Action, you can perform the required logic to send the email to the required target, with any custom Email Subject, Body, and Attachment FileName.
Here’s a bit of a code excerpt where I do exactly this
-- Set To List
to_list_ := pdf_sent_to_;
-- Set CC List
cc_list_ := user_mail_address_;
-- Retrieve PDF Archivebeginselect *
into pdf_archive_
from pdf_archive t
where t.result_key = result_key_
and t.print_job_id = print_job_id_
orderby t.created descfetchfirst1rowsonly;
exception
when others then
raise no_pdf_archive;
end;
language_code_ := upper(pdf_archive_.lang_code);
pdf_id_ := pdf_archive_.id;
-- Set PDF Name
report_title_ := initcap(Report_Definition_API.Get_Translated_Report_Title(report_id_ => report_id_,
lang_code_ => lower(language_code_),
default_value_ => 'Unknown_Report'));
pdf_title_ := report_title_;
-- Replace spaces in title with underscores
pdf_title_ := replace(pdf_title_,' ','_');-- Replaces any characters not accepted as a filename with dashes
pdf_title_ := replace(pdf_title_,'\','-');
pdf_title_ := replace(pdf_title_,'/','-');
pdf_title_ := replace(pdf_title_,'*','-');
pdf_title_ := replace(pdf_title_,'?','-');
pdf_title_ := replace(pdf_title_,'"','-');
pdf_title_ := replace(pdf_title_,'<','-');
pdf_title_ := replace(pdf_title_,'>','-');
pdf_title_ := replace(pdf_title_,'|','-');
pdf_name_ := pdf_title_||'_'||result_key_||'_'||print_job_id_||'.pdf';
-- Set Attach
attach_ := '###'||pdf_id_||'###'||print_job_id_||'###'||result_key_||'###'||pdf_name_;
(The last bit there, for setting Attach, is just one way of doing this, but this format is something that is accepted by the Mail Sender to retrieve the right file data. There’s other ways of doing this, I can elaborate if required but this is just the “simplest” way).
You can then set the Body/Subject as you want to and basically you end up calling command_sys.mail with the following parameters
Obviously you’d want to make sure the from_email_ is a mail address that your mail_sender account has access to (such as itself, or any other mailbox it has send as privileges on).
We use 3 different kinds of cookies. You can choose which cookies you want to accept. We need basic cookies to make this site work, therefore these are the minimum you can select. Learn more about our cookies.