[My environment: Bonita BPM 6.2 (Community Edition) / Windows XP / MySQL database] <br><br>
Hello,<br><br>
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.<br><br>
I've looked everywhere for a solution, and I'm about to give up :-/<br><br>
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.<br><br>
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).<br><br>
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.<br><br>
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 <div> 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.
Thanks a lot, Declan. A clear, concise and honest answer, Kudos to you :-D<br>
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...<br>
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...<br>
Bonitasoft empowers development teams with Bonita, the open-source and extensible platform to solve the most demanding process automation use cases. The Bonita platform accelerates delivery of complex applications with clear separation between capabilities for visual programming and for coding. Bonita integrates with existing solutions, orchestrates heterogeneous systems, and provides deep visibility into processes across the organization.