AVIO Consulting

Protected Flex Fields in Oracle BPM

Jul 13, 2017 | BPM

People are often confused when it comes to creating and using flex fields in Oracle BPM.  A while back, I wrote a blog on public flex fields, but this discusses protected flex fields, some best practices, and a how to avoid a bug when using them..

Flex fields are important to know how to use because it is helpful to show instance information in the list of tasks in the Workspace.  This is done either using a protected or public flex field. 

Flex Fields in the Oracle BPM Workspace

 

 

 

 

 

Both public or protected flex fields serve the same function.  They are simply created slightly differently and are mapped to a different set of flex field attributes.  I personally prefer using protected attributes because I’m a pretty simple guy, and find the path to creating and using them to be a simple three step process:

1. Assigning a label to a protected flex field in the Workspace

2. Adding a mapped attribute in the human task in your Oracle BPM project in JDeveloper

3. Adding the protected flex field as a column in a view in the Workspace

1. Assigning a label to a protected flex field in the Workspace

First, to add the labels for the different protected flex fields, log in as an administrator in the Workspace.  In 12c, click the administrators’ user id in the upper right corner -> click Administration from the drop-down.  Select Protected Flex Fields -> wait a minute for the Protected Flex Field Mapping form to display and then click  +.  

If you wanted to display a candidate’s name in a Workspace’s inbox task list or view in the third step, you would enter text “Candidate Name” in the Label Name field (this is the text that will be displayed in the header of the column in the Workspace’s task list) -> click the Create button.

Assign a label to a protected flex field

 

 

 

 

 

 

 

 

 

A common problem I see is when several different protected flex fields are all given the same label (e.g., “Name”).  If this is done, you’re going to get confused in the third step because you will see text “Name” three times in the Available Columns list to be displayed.  As a best practice, give each of the flex fields different label names (e.g., “Candidate Name”, “Company Name”) to avoid getting confused in the third step. 

A problem occurs when you try to add more than one label for a specific protected flex field.  Do not do this.  There is a bug that prevents this from working correctly.

Protected Flex Field assigned multiple labels

 

 

 

 

As shown above, although the user interface appears to allow a single flex field (ProtectedTextAttribute1 in this case) to be assigned several labels, only the first label will be displayed (“Candidate Name” in this example), at runtime in the Workspace.

Result of adding Protected Flex Field assigned multiple labels

 

 

 

 

 

 

 

 

 

If only one label is added to the view and it is not the first label, the first label will be displayed instead of the one you wanted.

The key thing is to avoid assigning multiple labels to the same protected flex field.  Work around this issue by not adding multiple labels to a single flex field, and instead use any one of the other Protected Text Attributes or 20 Public Text Attributes for the other label assignments.  

2. Adding a mapped attribute in the human task in your Oracle BPM project in JDeveloper

Because the Workspace’s task list shows information currently inside human tasks and because flex fields can only show primitive variables (e.g., strings, numbers, and integers), a new mapped attribute needs to be added inside the human task for each value to be displayed in the Workspace.  To add the mapped attribute, open the Oracle BPM project’s human task in JDeveloper -> click the human task’s Data tab -> click + beside the Mapped Attributes.

Add a protected flex field's mapped attribute

 

 

 

 

From the top drop-down, select the Application Server where the project is deployed -> in the Attribute dropdown select the protected flex field label created in the first step (“Candidate Name (Protected Text Attribute1” in the example below) that was previously added to the Workspace  for the Value field -> select the XPath Expression icon to the right of the Value field to map the flex field with the human task element.

Assigning the mapped attribute to the flex field

 

 

 

 

 

Expand payload from the list -> select the primitive element to associate it to -> click the Insert Into Expression button.

Assign the payload element to the mapped attribute

 

 

 

 

 

 

 

 

 

Once you click OK, the new mapped attribute should now be present in the human task Data tab.

Mapped attribute in the human task's Data tab

 

 

 

Redeploy the BPM project so that the change can take effect. 

3. Adding the protected flex field as a column in a view in the Workspace

Add the flex field columns to views in the Workspace by clicking the Edit Settings pencil button.

Edit the inbox view

 

 

 

 

Scroll down the Available Columns list on the left to the bottom and select the desired protected flex fields to be added (in the example below, the protected flex field labels “Salary” and “Candidate Name” will be added) -> click the > button to add these to the Selected list -> click OK.

Select the protected flex fields labels to add to the view

 

 

 

 

 

 

To test that the information is displayed in the Workspace, create a new work item instance in the process.  Ensure the new instance reaches the activity associated with the human task modified in the second step.  Note the specific instance information displayed in the view/inbox.

Workspace displaying protected flex fields in the inbox

 

 

 

Again, avoid these two issues when using flex fields:

1. Do not use the same text for labels in different flex fields.  If in the first step you made the mistake of assigning the text “Name” to three different protected flex field labels, then you will see “Name” three times in the Available Columns list.  

2. Do not assign multiple labels to the same flex field.  If this is done, only the first label assigned to the flex field will be displayed on the view.