BOS 6.2 - How to fill a form from a DB record? (step-by-step, *please*)

1
0
-1

[My environment: Bonita BPM 6.2 (Community Edition) / Windows XP / MySQL database]

Hello,

I’m a beginner in the BPM/Java/Groovy world and, although I’ve been able to do things like insertions and updates to a MySQL database from Bonita using forms and connectors, I have yet to find a clear, step-by-step method to do a Select query based on a value entered in a form by a user and fill out the rest of the form with the results of the Select.

I've looked everywhere for a solution, and I'm about to give up :-/

The details: In one of my tasks, I have a form with 5 (initially empty) fields. The first field is an ID input text box, which must be filled out by the user once he/she is presented with the form.

Upon filling out this ID field, the user clicks on a button and the rest of the fields must be completed by Bonita (by sending a SELECT query to the MySQL database using the ID entered by the user; we’re assuming a single record –or none- will be returned for each ID).

I’ve tried to implement this very basic functionality using a database connector, but in the Community Edition, connectors either run at the beginning or at the end of the task, neither of which seems appropriate for something that happens “in the middle” of a task. I’ve also tried to use a Groovy script in the “Action” portion of the Submit button of my form, but I get a ton of errors. Basically, I have no idea how to take the single record retrieved from the MySQL database and assign each field (ID, Name, Date, etc) to a text box in the form.

Thanks a lot for the help…

Alex

1 answer

1
+1
-1

Hi Alex,

don't give up.

Ok so what you want to do is very straightforward in the subscription package, where there are contingencies in the formbuilder. It's less easy in the community version - it relies on you having a pretty good knowledge of javascript - the solution is to create your own

and populate it with a javascript function (also something you will write yourself) that you will invoke using an html action - onClick(), or onChange() - from your widget. You will also have to write the servlet that will retrieve the data you want to populate based on the Id you entered.

I recommend you upgrade immediately to a subscription package. - Full disclosure : I am a BonitaSoft employee, so of course I want you to upgrade.

Since you are new to java / groovy, i may recommend an incremental approach. Create a single page to take the ID as input. Call a DB connector to retrieve the data (onFinish of the 1st activity) and create a 2nd activity to display the data that the DB connector has returned. This gives you a 2 stage load for your data, which may not be ideal, but it will get you the functionality you need.

-Declan

Comments

Submitted by aolazaba on Fri, 02/28/2014 - 11:05

Thanks a lot, Declan. A clear, concise and honest answer, Kudos to you :-D

I thought I was missing something obvious, but you've confirmed that doing what I need using Community Edition is quite involved (for my level). What surprises me is that no one in my situation seems to have written the Javascript code and the widget you mention, or at least they haven't mentioned it online...

In any case, until my project gets the funding to upgrade to a subscription package, I'll have to make do with the workaround you proposed...

Alex

Notifications