Multiple Attachments in Notifications(In Table Format)
Step1 :
Create a Document Type Item Attribute.
Step 2 :
Drag and Drop the item attribute in the Message you want to display the attachments.
Step 3 :
In your Message body Select HTML Body and paste give the attribute internal name
Step 4 :
Create a Procedure get_docs_in_notification.
create or replace
Procedure get_docs_in_notification( document_id IN VARCHAR2
,display_type IN VARCHAR2
,document IN OUT VARCHAR2
,document_type IN OUT VARCHAR2
)
IS
V_SAMPLE1 VARCHAR2(1000);
v_document_id varchar2(1000);
BEGIN
v_document_id :=document_id;
SELECT FND_GFM.CONSTRUCT_DOWNLOAD_URL
(FND_WEB_CONFIG.GFM_AGENT,document_id)
INTO V_SAMPLE1
FROM DUAL;
IF DISPLAY_TYPE = 'text/html' THEN
DOCUMENT :='<STYLE TYPE="text/css">';
DOCUMENT := DOCUMENT || 'TD{font-family: Arial; font-size: 10pt;}';
DOCUMENT := DOCUMENT || 'TH{font-family: Arial; font-size: 12pt;}';
document := DOCUMENT || '</STYLE>';
document := DOCUMENT || '<table border=1>';
DOCUMENT := DOCUMENT || '<tr>';
DOCUMENT := DOCUMENT || '<th colspan="2">Attachments</th>';
DOCUMENT := DOCUMENT || '</tr>';
FOR ILOOP IN (SELECT ROWNUM,
FDV.TITLE,
FND_GFM.CONSTRUCT_DOWNLOAD_URL
(FND_WEB_CONFIG.GFM_AGENT,fdv.media_id) as f_media_id
FROM FND_ATTACHED_DOCUMENTS FAD,
FND_DOCUMENT_ENTITIES FDE,
fnd_documents_vl fdv
WHERE FAD.ENTITY_NAME = FDE.DATA_OBJECT_CODE
AND FDE.DATA_OBJECT_CODE = 'XX_PNK_FORUM_ATTACHMENT'
AND FDV.DOCUMENT_ID = FAD.DOCUMENT_ID
AND fad.pk1_value = v_document_id
) LOOP
document := document || '<tr>';
DOCUMENT := DOCUMENT || '<td>';
DOCUMENT := DOCUMENT || ILOOP.ROWNUM;
document := document || '</td>';
document := document || '<td>';
DOCUMENT := DOCUMENT || '<a href = "';
DOCUMENT := DOCUMENT || ILOOP.F_MEDIA_ID;
DOCUMENT := DOCUMENT || '">';
DOCUMENT := DOCUMENT || ILOOP.TITLE;
document := document || '</a>';
document := document || '</td>';
document := document || '</tr>';
End Loop;
document := document || '</table>';
End If;
document_type := display_type;
END get_docs_in_notification;
Step 5 :
Now Call this procedure when setting value for your document through Pl/SQL.
WF_ENGINE.SETITEMATTRDOCUMENT(
L_ITEMTYPE,
L_ITEMKEY,
'DOC_AS_TABLE',
'PLSQL:get_docs_in_notification/' || 1014
);
The Output Will Be like :




No comments:
Post a Comment