Looks like you are trying to attach a report while sending the URL for the relevant IFS form as a URL.
So, assuming that you need to run a Customer Order report and send the email with the URL for that customer order, do the following.
- Create an event action against PDF_REPORT_CREATED
- Create the correct condition like REPORT_ID = CUSTOMER_ORDER_REP
- Select type SQL
- Paste the following snippet and it should work when the PDF_PARAMETER_1 contains the related ORDER_NO and PDF_PARAMETER_2 contains the related recipient’s email address.
DECLARE
order_no_ VARCHAR2(10000);
pdf_ VARCHAR2(10000);
receiver_ VARCHAR2(10000);
url_ VARCHAR2(10000);
subject_ VARCHAR2(10000);
body_html_ VARCHAR2(10000);
base_ VARCHAR2(10000);
BEGIN
pdf_ := '&PDF_FILE';
order_no_ := '&PDF_PARAMETER_1';
receiver_ := '&PDF_PARAMETER_2';
base_ := '<system_url>/client/runtime/Ifs.Fnd.Explorer.application?url=';
url_ := base_ ||
'ifsapf:frmCustomerOrder_Cust?EXTERNAL_SEARCH=ORDER_NO=' ||
order_no_;
subject_ := 'URL Test';
body_html_ := REPLACE('<html>
<head>
<title>Emailing</title>
</head>
<body>Dear Sir, Madam<br>
<br>The report is ready.
<br>Order details - <a href=#URL#>Click here</a>
<br>
</body>
</html>', '#URL#', url_);
Command_SYS.Mail(from_user_name_ => FND_SESSION_API.Get_Fnd_User,
to_user_name_ => receiver_,
text_ => body_html_,
attach_ => pdf_,
subject_ => subject_);
END;