Skip to main content
Solved

Change Attached Invoice Name


Forum|alt.badge.img+10

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?

 

 

We are on aurena 23.1.13

 

Thank you in advance

Best answer by dsj

Hi ​@IFSRUNINNOVAL 

 

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 :)

 

Cheers!

Damith

View original
Did this topic help you find an answer to your question?

dsj
Ultimate Hero (Partner)
Forum|alt.badge.img+22
  • Ultimate Hero (Partner)
  • April 24, 2025

Hi ​@IFSRUNINNOVAL 

 

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 :)

 

Cheers!

Damith


Forum|alt.badge.img+12

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:

 

 

 

 

 

 

 

  1. 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 Archive
  begin
    select *
    into  pdf_archive_
    from pdf_archive t
    where t.result_key = result_key_
    and t.print_job_id = print_job_id_
    order by t.created desc
    fetch first 1 rows only;
  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

 

  -- Send Email 


      COMMAND_SYS.Mail(sender_      => '',
                     from_        => from_email_,
                     to_list_     => to_list_,
                     cc_list_     => cc_list_,
                     bcc_list_    => '',
                     subject_     => subject_,
                     text_        => text_,
                     attach_      => attach_,
                     mail_sender_ => 'MAIL_SENDER1'); 

 

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).

 

 

 

 

 


dsj
Ultimate Hero (Partner)
Forum|alt.badge.img+22
  • Ultimate Hero (Partner)
  • April 29, 2025

Nice hack ​@SimonTestard  😎

 


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings