Skip to main content

Hi all,

In IFS10 UPD4 I have developed an automated process to take an authorised Purchase Requisition, convert it to a Purchase Order, release it and then email the requisitioner with the order details. I would like to attach a PDF copy of the PO (or send one from another Event Action) but have not managed to figure out how to do it.

I have an Event configured against the PURCHASE_ORDER_TAB table that triggers when the PO is Released and then an Event Action E-mail to inform the requisitioner, but there are no Event linked attachments available to attach.

Does anyone know how to code the printing and emailing functionality?

Thanks in advance,

Ged Pierce.

Hey,

 

It would be done with this part of the cursor:

 

-- Doc Man
for doc_man_rec_ in (

select i.doc_class, i.doc_no, i.doc_sheet, i.doc_rev, e.file_no, e.user_file_name, e.doc_type, s.file_data
from ifsapp.doc_issue_tab i
left join ifsapp.edm_file_tab e on e.doc_class = i.doc_class and e.doc_no = i.doc_no and e.doc_rev = i.doc_rev and e.doc_sheet = i.doc_sheet
left join ifsapp.edm_file_storage_tab s on s.doc_class = i.doc_class and s.doc_no = i.doc_no and s.doc_rev = i.doc_rev and s.doc_sheet = i.doc_sheet and s.doc_type = e.doc_type
where i.rowstate = 'Released' and s.doc_type = 'ORIGINAL'
fetch first 1 rows only

) loop

 

 

When you get the Purchase Order to Print, through the PDF_REPORT_CREATED event, you’ll get several parameters like result_key, print_job_id, etc.

 

From those parameters, you can retrieve the Purchase Order_No

 

Typically I do it like this:

 

From the Order No, you can then check documents attached to header/lines through the DOC_REFERENCE_OBJECT view/lu, based on the KeyRef:

Example here is for PurchaseRequisition but can be changed to PurchaseOrder or anything else to grab any attachment to any IFS Object.

 

This will give you the Document Keys to use to filter in the main cursor to grab documents attached to a given PO Line/Header

 

 

Hi @SimonTestard 

This code is to fetch the documents. But how can we send them to the printer?
For example, as soon as we send the PO report to physical printer, then we should also send these documents to print immediately along with the report. Is this possible?

 

I’m not exactly sure as this is to fetch and EMAIL Documents, if you want to send them to a printer, you’d need to add code to send them to a particular printer if what you’re after is a physical print :)

 

Are you actually after a PHYSICAL print of the attached documents ? This entire thread was about automatically emailing documents so I’m a bit confused.

 

You don’t need to PRINT attached documents if what you’re after is emailing them.


Hi @SimonTestard ,

Yeah, you understood it right. I want them to be sent to physical print that too immediately after the order report print, so it is almost like attaching the documents to the report and printing them all at once as a single report.

This post is about emailing documents, but I hoped that since you worked on logic to fetch the documents, then may be you might also know about printing them.


Sorry, can’t say I’m familiar with which API one would use to send a document management revision to a particular print agent, if it’s even possible.

The Print Job and Print Job Contents LUs are basically linked to result keys and therefore to Operational Reporting, so I don’t think you can use those to request a file print to a logical/physical printer through the print agents, but I could be wrong or not know how to do it

 

You could possibly do it through an Application Message using Routing Rules / App Message Queues and so on, but that’s not something I’ve done before


Hi @SimonTestard ,

Understood. Thank you for all the info you shared so far!


@SimonTestard Thank you for the script. It is beneficial


Reply