Oracle BPM: Adding an attachment during the Human Task Initialization

Recently I had the requirement from a customer to instantiate a Human Task, which can accept a payload containing a binary attribute (base64) representing an actual document. According to the same requirement, this attribute should be shown as a hyperlink in the Worklist UI to the assignee(s), from which the assignees can download the document on the local machine for review. Multiple options have been leverage, but most required heavy customization. 

In order to leverage as much as possible Oracle BPM out-of-the box functionalities, I decided to add this document as a readonly attachment. We can easily achieve this operation within Worklist Application, but it is a bit more challenging when we want to attach the document during the Human Task initialization. 

After some investigations (on BPM 11g PS4FP and PS5), here's the way to go:

1. Create an asynchronous BPM process, and use this xsd to create 2 Business Objects FullPayload and PartialPayload :


2. Create 2 process variables 'vFullPayload' and 'vPartialPayload' using this Business Objects created above

3. Implement the Start Event with the initial Data Association, with an input argument using 'FullPayload' Business Object type

4. Drag in an User Task into the process. Implement the User Task as usual by using 'vPartialPayload' type as the input type and assign the task to your favorite tester (mine is jcooper)


5. Here's the main course - Start the Data Association and map the payload into 'execData' as follow:

FROM TO
 vFullPayload.attachment.mimetype  execData.attachment[1].mimeType
 vFullPayload.attachment.filename  execData.attachment[1].name
 bpmn:getDataObject('vFullPayload')/ns:attachment/ns:content  execData.attachment[1].content
 'BPM'  execData.attachment[1].attachmentScope
false()  execData.attachment[1].doesBelongToParent
'weblogic'  execData.attachment[1].updateBy
 xp20:current-dateTime()  execData.attachment[1].updateDate

(Note: Check the <Humantask>WorkflowTask.xsd file in your project xsd folder to discover the different options for attachmentScope & storageType)

6. Your process is completed. Just build a standard ADF UI and deploy the process/UI onto your BPM Server for the testing. Here's an example, with a base64 encoded pdf file: application-pdf.txt

7. Finally, go to the BPM Worklist application to check the result !

Please note that Oracle BPM, by default, limits the attachment document size to 2Mb. If you are planning to have bigger attachments in your process, it is recommended to store your documents in a Content Management server (such as Oracle UCM) and pass the reference instead. It is possible to configure Oracle BPM to store attachment directly into Oracle UCM too, and I believe we can use the storageType, ucmMetadataItem attributes for this purpose.... I will confirm once I have access onto an Oracle UCM for the testing :)

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

Hi, I am Manh-Kiet Yap (known as Kiet @oracle) and I'm currently the Technical Director at the APAC Advanced Customer Services.

I've recently received my 15 years of long service award, after being successively Technical Consultant in France, Presales at Hong Kong, FMW Product Manager in EMEA, Presales Mgr in APAC and finally Architect at Oracle ACS.

With my 15 years experience around Middleware, I hope you will find this blog valuable if you are navigating around Oracle Fusion Middleware !

View Manh-Kiet Yap's profile on LinkedIn

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today