| Home |
| Technical Articles |
| Training Articles |
| Receive Email for New Articles |
| Contributors |
| Hands-On-Training |
| Apps Book |
Technical Articles
Oracle Workflows
Send binary attachments with Notifications in Workflow
| Send binary attachments with Notifications in Workflow | | Print | |
| Written by Anil Passi | |
| Friday, 01 September 2006 | |
|
Below I have listed a 4 step solution to send MsWord or PDF or other types of Document Attachments with Oracle Workflows Notifications.
Using this simple technique, you can generate email notifications with attachments for Word or PDF or any other binary objects. ![]() Attribute for Attachment Source: Send Frame Target: New Window Attach Content: Yes. If you had dragged the Attribute from Workflow level into this message, then default sub-section will be populated automatically. Step 3. After executing the wf_engine.createprocess and before executing wf_engine.startprocess, we need to set a value for the attribute defined in Step 2. This can be done by calling wf_engine.setitemattrdocument as below wf_engine.setitemattrdocument (itemtype=>'XG4GWFIT' , itemkey=>'XG4GWFIT' || l_item_key , aname=>'XX_G4G_ATTACHMENT1' , documentid =>'PLSQLBLOB:xx_g4g_package.xx_notif_attach_procedure/' || to_char(l_file_id)); Please note the manner in which parameter documented is assigned. The syntax is PLSQLBLOB:<package name>.<procedure name>/<unique id to identify binary file> . In my example, I am capturing the file_id from fnd_lobs. In your case this ID will be derived depending upon whether you are looking for PO Attachment or say an attachment to Oracle Sales Order or a Resume in iRecruitment or some course notes in oracle Learning Management. Step 4. Handle the execution of the procedure, in this case xx_notif_attach_procedure PROCEDURE xx_notif_attach_procedure ( document_id IN VARCHAR2 ,display_type IN VARCHAR2 ,document IN OUT BLOB ,document_type IN OUT VARCHAR2 ) IS lob_id NUMBER; bdoc BLOB; content_type VARCHAR2(100); filename VARCHAR2(300); BEGIN set_debug_context('xx_notif_attach_procedure'); lob_id := to_number(document_id); -- Obtain the BLOB version of the document SELECT file_name ,file_content_type ,file_data INTO filename ,content_type ,bdoc FROM fnd_lobs WHERE file_id = lob_id; document_type := content_type || ';name=' || filename; dbms_lob.copy(document, bdoc, dbms_lob.getlength(bdoc)); EXCEPTION WHEN OTHERS THEN debug('ERROR ^^^^0018 ' || SQLERRM); wf_core.CONTEXT('xx_g4g_package' ,'xx_notif_attach_procedure' ,document_id ,display_type); RAISE; END xx_notif_attach_procedure; Please note the following:- Note 1. In step 3, the value of Unique File id that is passed in after / gets translated into document_id in step 4. This translation occurs within the workflow engine, when it splits the pl/sql name from parameter. Note 2. Proecdure xx_notif_attach_procedure must be defined in the package specification too. Note 3. This procedure has an out parameter “document IN OUT BLOB” Note 4. The value from the Oracle Blob column is fetched into blob variable bdoc from fnd_lobs. Note 5. Next you can use dbms_lob.copy to copy the value from blob variable into out parameter for notification. Thanks for reading this article. Kindly share this knowledge with your colleagues as this happens to be a very useful feature of Oracle Workflows. Thanks, Comments
(28)
written by nasir , November 14, 2006
let me try it out and get back here
written by nasir , November 14, 2006
let me try it out and get back here
written by Anil Passi , November 15, 2006
Hope it worked Naser, it should, as I implemented this for a OTA (OLM) workflow
written by Anil Passi , November 15, 2006
Hope it worked Naser, it should, as I implemented this for a OTA (OLM) workflow
written by Anil Passi , January 21, 2007
Hi Umesh,
I assume you are doing the below:- You have subscribed to the event that gets fired after IRC vacancy creation. This Workflow subscription is then send notification with attachment. Now to answer your question, well it is answered in Step 3 in this article. After the package dot procedure name you are passing the File ID from which blob can be derived. I guess IRC uses its own table to store those attachments[does not use FND_LOBS]. THe document id in this case will be the id that you assign to the attribute[of type document]. Regarding the package spec and body, you can define in whatever way you wish. However the package procedure that gets assigned to attribute will have parameters of document_id IN VARCHAR2 ,display_type IN VARCHAR2 ,document IN OUT BLOB ,document_type IN OUT VARCHAR2 Thanks, Anil Passi written by umesh , January 21, 2007
hi anil,
can you tell me.. i> how in parameters document_id, display_type will get pass in the procedure xx_notif_attach_procedure ii> how exactly package specificatin & body for xx_g4g_package will look like. i will be very greatful if you can tell me, i am ref. this article for sending an attachment through notification after creation of vacancy in the irecruitment. regards, Umesh written by Anil Passi , January 21, 2007
Hi Umesh,
I assume you are doing the below:- You have subscribed to the event that gets fired after IRC vacancy creation. This Workflow subscription is then send notification with attachment. Now to answer your question, well it is answered in Step 3 in this article. After the package dot procedure name you are passing the File ID from which blob can be derived. I guess IRC uses its own table to store those attachments[does not use FND_LOBS]. THe document id in this case will be the id that you assign to the attribute[of type document]. Regarding the package spec and body, you can define in whatever way you wish. However the package procedure that gets assigned to attribute will have parameters of document_id IN VARCHAR2 ,display_type IN VARCHAR2 ,document IN OUT BLOB ,document_type IN OUT VARCHAR2 Thanks, Anil Passi written by umesh , January 21, 2007
hi anil,
can you tell me.. i> how in parameters document_id, display_type will get pass in the procedure xx_notif_attach_procedure ii> how exactly package specificatin & body for xx_g4g_package will look like. i will be very greatful if you can tell me, i am ref. this article for sending an attachment through notification after creation of vacancy in the irecruitment. regards, Umesh written by Vamsi Mohan , March 16, 2007
Hi Anil,
I tried this in 11.5.8 and i got the following error when i clicked on the attachment icon in the notification. fnd_document_management.get_launch_document_url(plsqlblob:my_procedure1/10) Wf_Notification.GetAttrDoc(134824, ACN_DOC_ATTR, text/html) Wfa_Html.show_plsql_doc(134824, ACN_DOC_ATTR) I have created the procedure as myprocedure1 and passing the constant 10. When i looked at the signature of the procedure fnd_document_management.get_launch_document_url it has the following parameters username document_identifier display_icon launch_document_URL but in the error stack i could see only the document URL. Do i need to do any setup? Thanks Vamsi written by Ram , April 13, 2007
Dear Passi,
PO Approval Notification does not contain the Attachment icon, to view the attached documents in the PO.. (whereas, requisition notification contains this attachment view facility) How do I customize this?? Can you help us please.. Regards, Ram written by Ram , April 13, 2007
Dear Passi,
PO Approval Notification does not contain the Attachment icon, to view the attached documents in the PO.. (whereas, requisition notification contains this attachment view facility) How do I customize this?? Can you help us please.. Regards, Ram written by Anil Passi , April 14, 2007
Hi Ram
This is due to the Workflow Message Attribute. Have a look at below link http://docs.google.com/Doc?id=dcfd8fsc_52dqr7kr You may either delete it from Req or develop something similar for PO The workflows in question are:- POAPPRV PO Approval AND REQAPPRV PO Requisition Approval Thanks, Anil Passi
Hi Anil,
This is a great document. I have used the same to send the output of a concurrent program to an intended user using the above method. But When I am send the notification I am getting the following error. Error Name = WF_ERROR Error Message = [WF_ERROR] ERROR_MESSAGE=3835: Error '-20002 - ORA-20002: [WFMLR_DOCUMENT_ERROR]' encountered during execution of Generate function 'WF_XML.Generate' for event 'oracle.apps.wf.notification.send'. ERROR_STACK= xx_email_report.xx_notif_attach_procedure(831149, text/html) Wf_Notification.GetAttrblob(769915, XM_ATTACH, text/html) WF_XML.GetAttachment(769915, text/html) WF_XML.GetAttachments(769915, http://aperpppd.cellc.net:8002/pls/PPRD, 2136) WF_XML.GenerateDoc(oracle.apps.wf.notification.send, 769915) WF_XML.Generate(oracle.apps.wf.notification.send, 769915) WF_XML.Generate(oracle.apps.wf.notification.send, 769915) Wf_Event.setMessage(oracle.apps.wf.notification.send, 769915, WF_XML.Generate) Wf_Event.dispatch_internal() Error Stack = Activity Id = 224318 Activity Label = XX_USER_ACCESS:XX_NOTIFICATION Result Code = #MAIL Notification Id = 769915 Assigned User = ATALLURI Would you please help me in getting the problem solved. Thanks in Advance.
Hi Anil,
I want to add Comments in the FYI Notification, and pass it to the next Approver, for this i have made two rules having category as 'FYI' and 'Approver'. My process is explained below, A-->B-->C, over here 'A' is the initiator 'B' is the FYI reciever and 'C' is the final approver, i need to design the process so that when 'A' enters some comments it should be visible to 'B' and when 'B' enters some comments 'C' should be able to view all comments i.e. given by 'A' and 'B'. Please provide some information on the approach basically i am unable to carry forward and write comments. Regards, Vivek
Has anyone done this before
to runa concurrent program report from oracle workflow and then attac the output of the report to a notification the output of the report is PDF ( from XML Publisher) Thanks Rahul
Hi Anil,
I need to send a report output as an attachment in WF (XML publisher output). I have got the request id and the path of the output file. But Now I am unable to send this output file as an attachment to the user using WF. Can you help me.... I can send the URL(link) using fnd.request.add_notification() but I need to send it as an attachment. Thanks, Nagender
Please send me the part where you are arraching the URL for the concurent report through
workflow my client nned it greatly appreciate your help thanks rahul rahul_pardeshi@yahoo.com
Hi anil,
How do i find the path where concurrent program output PDF is stored. here u have used fnd_lobs. How can i capture , concurrent program o/p file here. regards ravi
Hi Anil,
I have a question related with normal workflow notifications. Can i send more than 32k size message as a notification's content. Regards, Sandeep
This is in continuation to one of the previous posts:written by Ajay Talluri , July 09, 2007
I am facing similar error Error Name = WF_ERROR Error Message = [WF_ERROR] ERROR_MESSAGE=3835: Error '-20002 - ORA-20002: [WFMLR_DOCUMENT_ERROR]' encountered during execution of Generate function 'WF_XML.Generate' for event 'oracle.apps.wf.notification.send'. ... ... while trying to attach PDF documents(PLSQLBLOB) to the notificatons..any idea what can be possible causes for the same. Thanks Subhankar
Hi,
I want to send FYI and approve notification for vacancy approval. Can you tell me how i can do that? My Req is once some approve vacancy i need to send FYI to third person.
Hi,
I have workflow working already for vacancy approval. What i need is when some one approves vacancy, it should send FYI to third person. So i can add this req in existing workflow so that i can achieve FYI notification along with approvals. Hi anil, How do i find the path where concurrent program output PDF is stored. here u have used fnd_lobs. How can i capture , concurrent program o/p file here.
Hi Anil,
I've one more doubt again. How we are putting the data into FND_LOBS Table? i.e any api which I can use to insert data into FND_LOBS. In Detail: I have data in one table and will be sending notification based on data in it. Now as soon as notification is send we want to delete the records in table. I tried using CLOB for it. But as soon as records gets deleted previously send notifications also fails to open. So I thought if I can put my data in FND_LOB as some rtf file and will base my attachment procedure to fetch the data from FND_LOBS and for this I need an api to insert the data into FND_LOBS. Thanks & Regards Sachin Ahuja
Hi Rose,
The concurrent program output path can be retrieved from fnd_concurrent_requests table. The column name is outfile_name. Thanks, Vicky You must be logged in to a comment. Please register if you do not have an account yet.
|