Add Purchase Order Attachments to the Same Email , When Print Order
Hello Everyone,
There is a requirement to send Attachments with the same email of the Purchase Order’s Print Order...
The mail should contain the attachments of the Purchase Order as well as the Purchase Order report.
This should be happen only if the attachments are in specific document classes eg: 4600 - 4699.
This should be work in Aurena as well.
Please let me know if you have any idea of how to do this.
Many Thanks,
Denuka
Page 1 / 1
@MitDenukN Please see if this thread helps answer your question.
Thank you very much @EnzoFerrari .
Thread has given the answer for my question and I will give it a try.
You are welcome @MitDenukN , once you’ve tested it, please keep us posted if it worked
That code is working and I had to do few modifications to fetch values. Please find below code to use in PDF_REPORT_CREATED event action:
DECLARE
keyref_ VARCHAR2(4000); extention_ VARCHAR2(260);
CURSOR get_attachments IS select a.doc_class, a.doc_no, a.doc_sheet, a.doc_rev, b.doc_type, b.file_no, b.file_extention, b.file_name from doc_reference_object a, edm_file b where a.lu_name = 'PurchaseOrder' and b.doc_class = a.doc_class and b.doc_no = a.doc_no and b.doc_sheet = a.doc_sheet and b.doc_rev = a.doc_rev and a.doc_class between 4600 and 4699 and a.key_ref = keyref_;
select x.data into xml_ from xml_report_data x where x.result_key= '&RESULT_KEY';
x_:= xmltype.createxml(xml_);
SELECT extractvalue(x_, 'PURCHASE_ORDER_PRINT_REP/PO_HEADERS/PO_HEADER/ORDER_NO') INTO order_no_ FROM DUAL; SELECT extractvalue(x_, 'PURCHASE_ORDER_PRINT_REP/PO_HEADERS/PO_HEADER/SUPPLIER_NO') INTO supplier_id_ FROM DUAL;
keyref_ := 'ORDER_NO=' || order_no_ || '^';
FOR rec_ IN get_attachments LOOP
SELECT SUBSTR(rec_.file_name , INSTR(rec_.file_name , '.') + 1) INTO extention_ FROM dual;
IF (error_msg_ IS NOT NULL) THEN Batch_Transfer_Handler_Api.Download_From_Db(error_msg_, rec_.doc_class, rec_.doc_no, rec_.doc_sheet, rec_.doc_rev, 'VIEW', rec_.file_no, attachment_name_); END IF;
But there is another concern, If user enter an email address in Print Dialog Box, recipient will get multiple mails.
Is there any possibility to modify the Application Message and attach those attachment to the mail other than using PDF_REPORT_CREATED event action ?
@MitDenukN which IFS version and update are you using? Looks like the event PDF_REPORT_CREATED generating more than 1 email to the recipient is an error in IFS
@EnzoFerrari event action PDF_REPORT_CREATED is sending one email and the other email is from Print dialog box’s email. Emails are in different Queues in Application Messages window.
PDF_REPORT_CREATED mail comes under NOTIFICATIONS and the other comes under OUT1.
(It’s IFS Apps 10 UPD12)
@MitDenukN apologies for not being able to solve your last query. But I see you have initiated a new thread on that and a few options are suggested there. Hope you will soon get the overall clarification you are seeking.
happy weekend!
p.s. For anyone wondering where the new thread is, here’s the link.
@EnzoFerrari That’s all right, thank you for your suggestion and it helped me to implement on PDF_REPORT_CREATED. And also thanks for attaching the new thread to this.
Happy Weekend!
Please refer and perhaps upvote the following idea: