Showing posts with label BPM. Show all posts
Showing posts with label BPM. Show all posts

Wednesday, January 27, 2016

Rendering a drop down list dynamically on Oracle PCS Web form

Been wanting to blog a little experiment I did with Oracle Process Cloud's Web form. Current version of PCS is limited to Web forms; no ADF. I'll post the other shortcomings of current PCS release in another blog. The only way to build dynamic field/value behavior (for now at least)is by using Javascript, JSON and REST.
Here is how you to build a 'drop down' that loads country names at run time.
Login to PCS account > composer> application.
Create a new form. I am calling it CountryList.
Drag and add a 'drop down' component on to the form. I am also adding a message component to show the selected country.
Click on the 'Create Rule' icon on top right of the form and add a new rule.
Type the rule below to load country list from a public JSON service on form load.
The code above reads country names from the JSON service and constructs a temporary array - v_Countries - from the 'name' elements of the JSON array. This temp array is then assigned to drop down Options.
Add an additional line to display the selected drop down value on message component. Web forms are smart enough to rerun the rules every time an event occurs in the component - which is value change in our case.
Test the form using the 'preview' button on top right.

Monday, October 21, 2013

Populating database values in human task payload

I had a recent requirement to populate database table values to BPM payload based on certain selections user makes in a human task UI. To add to the complication, there could be multiple rows that are associated with the user selection on UI and hence my BPM object had to be an array. Creating array objects and automatically populating them turned out quite tricky.

One way to solve this is by generating the payload as DOM and updating the BPM with java API.

A lesser complicated approach is to make use of ADF bindings. This article explains the steps.

1. Create the BPM project
2. Create the ADF Model for database
3. Generate the ADF UI for human task. This can be done using the auto-generate wizard.
4. Find the bindings for 'CreateInsert' button for the array object and the array UI table.
5. Comment out the source code for the button and table mentioned above.
6. From BPM data control, drag and drop the children of array object on to the jspx page.

7. This will create bindings the attributes of array object. We now have bindings for 'CreateInsert' button, the array itself and the array object attributes.
8. Comment out the array object attributes UI elements. We are only interested in the bindings. Not the source. You could always create bindings from the page definition file.
9. Construct the UI for database objects with action components. In my case, it was a select one choice drop down with a selectionListener.
10. From within the action listener in my backing bean (this could be a submit button as well), use an EL helper class to invoke 'CreateInsert' and then set array attributes with the database selected values. In between you could do any kind of operation, like calling another AM method to retrieve additional details.

11. In the back end we are creating the array object and populating it every time user makes a selection. In some scenarios you might want to delay this until user 'submit's the form. But either ways, the process of calling 'CreateInsert' setters will work.

For more complicated scenarios, working with human task API is the only option.