LinkedIn

Wednesday, June 29, 2011

Using Flex Fields in Oracle BPM 11g

While designing BPM Processes we might have a need to create Human Workflows. If we use the OOTB support to Auto Generate Task UI’s we get the standard Inbox view that in turn have standard data columns.

There may be a need to create a similar inbox like view but some additional task display columns may be required (preferably from the Task payload) to prioritize tasks in the inbox. The support of Flex fields can easily help us achieve this.

Human workflow flex fields store and query use case-specific custom attributes. These custom attributes typically come from the task payload values. Storing custom attributes in flex fields provides the following benefits:
  • They can be displayed as a column in the task listing
  • They can filter tasks in custom views and advanced searches
  • They can be used for a keyword-based search

The demonstration below will show a simple CardApproval business process and how Flex Fields is used in it.

Prerequisites
  • Oracle JDeveloper 11gR2 and above
  • Oracle SOA Suite and Oracle BPM Suite Domain with running managed servers

The Process

We have a very basic Business Process for Credit Card Approval similar to the one below

image

The process has starts with a MessageStart event thats is based on the below CreditInformation .xsd

<xsd:schema xmlns:xsd="<a href="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.beatechnologies.wordpress.com/card"
targetNamespace="http://www.beatechnologies.wordpress.com/card" elementFormDefault="qualified">
<xsd:element name="CreditInformation">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="cardNumber" type="xsd:string"/>
<xsd:element name="holderSsn" type="xsd:string"/>
<xsd:element name="holderFirstName" type="xsd:string"/>
<xsd:element name="holderLastName" type="xsd:string"/>
<xsd:element name="brand" type="xsd:string"/>
<xsd:element name="creditLimitRequested" type="xsd:double"/>
<xsd:element name="creditLimitGranted" type="xsd:double"/>
<xsd:element name="latePaymentCount" type="xsd:int"/>
<xsd:element name="creditScoringResult" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>

The Approve or Reject Card Application Human task is also based on the same input data type. Additionally also create a string input to the task as shown under.

image

Now the next part is to assign a value from the original payload to the creditLimitRequested variable of the Task Input form.

image

You can now create an Auto Generated Task Form from the ApproveCard.task file. The complete JDeveloper process used for this demo can be downloaded from here.

image

Deploy the completed Process and the UI to a running soa server.

The process being deployed now we can now create Flex Fields for the Task UI.

Open in a browser the BPM Workspace and login as an admin user.

http://host:port/bpm/workspace/faces/jsf/worklist/worklist.jspx

Once the Custom Inbox open go to the top right and click on the Adminstrator link. Click on the Public Flex Fields link under Flex Fields heading.

image

Once on the Public Flex Fields screen click on the green Add icon to create a new Label.

We can choose any predefined attribute type for creating a Label. Create a label called Limit Requested as under.

image

The second step will be to map this Label with the simple variable coming as part of the input to the Task form. For this check the “Edit Mappings by task type” radio button and follow the screen shot below.

image

Now the field created as a label is associated with the input variable customerCreditLimit of the Task form. This will now hold the value of credit limit requested for the credit card.

We can now create a custom view so that we can also see the column for the Limit Requested column in the inbox. For the same view we will also sort the tasks based on the limit amount so that the users can prioritize it.

Go to the Worklist Views heading and click on the green Add icon to create a custom Inbox/View.

Create a view called ‘Priority Approvals’.

image

Now click on the Display Tab to select the Limit Requested label as a column in the Task view. Also sort the tasks by the same field in a descending order.

image

Well that is pretty much it. Now you can test the Process as well as the Custom View by initiating the process with a simple request. Go to the EM console and locate the CardApproval composite. Test the composite from the EM console with some values.

image

Click on Test Web Service to test this. The Business Rules component allows automatic approval for Credit Limit Requests for VISA cards upto 20,000. The ones above it are sent for Manual Approval. So this request lands up in the user inbox.

You can now click on the ‘Priority Approvals’ view to see the custom Flex field added an column in the Task view.

image

You can find the BPM Process and UI Application at this location here.

No comments:

Post a Comment