BOS 6.2 - How to fill a form from a DB record? (step-by-step, *please*)
[My environment: Bonita BPM 6.2 (Community Edition) / Windows XP / MySQL database]
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…
don't give up.
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.
Thanks a lot, Declan. A clear, concise and honest answer, Kudos to you :-D
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...