Include additional attachments in IFS e-mail report is one of the top posts in my blog and received many good comments. One of the questions was that the methods used here are not compatible in IFS Cloud.
Script used in above post was developed for Apps8. By that time, Command_SYS.mail has limited capability of handling attachments. It could handle only files stored in extended server and add them as file path, and add the report pdf file.
Form IFS Application 10 onwards, Command_SYS mail functionality has several improvements. One major improvement is the way it handle attachments in emails. Now, it is possible to add attachments as an array of CLOBs or BLOBs or a file path (applied only for on-prem IFS cloud installations).
Below are the overrides of COMMAND_SYS.Add_Attachment for attaching documents stored in different data formats
PROCEDURE Add_Attachment (attachments_ IN OUT NOCOPY attachment_arr, filename_ IN VARCHAR2, attachment_ IN CLOB );
PROCEDURE Add_Attachment (attachments_ IN OUT NOCOPY attachment_arr, filename_ IN VARCHAR2, attachment_ IN BLOB );
PROCEDURE Add_Attachment (attachments_ IN OUT NOCOPY attachment_arr, filepath_ IN VARCHAR2, i_ IN NUMBER );
In this post, we will look into two common scenarios of including additional attachments in IFS emails.
Create a CSV and attach as a file in IFS email
Suppose it’s needed to create a CSV file with order details and attach with the Purchase Order email once it’s printed. We can create the CSV inside our event script and attach as a CLOB in the email. Below script shows the approach in detail.
Here’s the resultant email and the content of the CSV looks like
Send Email including Documents and media attached to the record
In this example, we are attaching the documents and media attached to the Work Order when printing the Work Order report.
I hope this would give a better idea on dealing with attachments in IFS report emails. You can mix and match the scripts and create emails with the information you need. Please share your thoughts or if you find any cool tricks with handling attachments below 😎
Hi Damith,
With this method, do you see any possibility to auto convert the .csv file into a .bin file and attached that .bin file into the email, when the file content is too large?
Regards,
Dulmini.
Hi Dulmini,
I think you should be able to do that if you can convert the file to the correct binary format you want.
This github repo contains some nice plsql utils to convert file to different binary format such as .zip. Hope it will help
https://github.com/mortenbra/alexandria-plsql-utils
Hi Damith,
Thank you. I’ll refer to the github repo.
Best Regards,
Dulmini.
Hi Damith,
Please can you send the PRD_REPORT_CREATED event action configuration which you used/
Thank you
Hi Madusha,
I’m not sure what you meant here. Can you please explain a bit more? 🙂
/Damith
Hi Damith,
Thank you this is very Helpful indeed.
I have a question releated to COMMAND_SYS.Mail, do you know if one could add this to a custom projection and then use it in a workflow in IFS Cloud? It seems getting information via projection calls is a lot easier than using the plsql functions/procedures
Thanks,
Bryan
Hi Bryan,
It’s possible to add COMMAND_SYS.Mail as a custom action in a projection. I’ll try to get the same setup working using a workflow and let you know 🙂
Regards,
Damith
Hi Damith,
It is very helpful. Thank you.
Thanks Hasan😎