O…K…
Quentin has already said some of this before.
Before i go too far you should understand this: from: http://documentation.bonitasoft.com/execution-sequence-states-and-transactions-0
Process instantiation form interaction
Initialization
1. The Portal displays the form to the user.
2. The user enters data in the form.
3. The button of the form having the Start process action in the UI designer send a POST request with the form data to start the process.
4. The submitted data are validated against the process instantiation contract.
5. If the contract is valid the process instance is created and input values are persisted in database.
6. Process data instances are created and initialized in the order of declaration using
* An operation declared on the process that saves its value to the process data
* The initial value expression if no operation is declared
* null if no expression or operation is defined
7. SP only The Engine creates and initializes search indexes.
8. The Engine creates and initializes business data.
9. The Engine initializes process instance Documents with default value coming from the definition or with submitted files.
10. Operations (that does not initialize data) are executed.
11. Completing the instantiation The Engine instantiates and executes the "on enter" connectors (evaluate input expression, execute, evaluate output operation). This an asynchronous operation. Execution duration of a connector is limited to a maximum of 5 minutes by default.
12. The process is instantiated, the API call finish and the Engine executes the process flow asynchronously.
SO what does this all mean:
The Initialization form will be shown first. There will be NO NEW BDM or variables available to access, 1 is followed by 8, not the other way round.
Why is this the case? Simple how many times have you started something, like a process, and then realized when you see the first form this is not what I want, I want X. Bonitasoft creates NO process at Initialization Form stage - only after clicking Submit.
If you need data either from a Database or a BDM they must exist before you instantiate your form.
Indeed I had a brain freeze moment recently on this, which Quentin helped with, thanks Quentin.
Here is an example I use
I need a drop down list on my Initialization form, this is a list of countries we deal with.
This list is kept via it’s own CRUD process, which creates a new BDO each time it’s updated.
NOTICE - I have TWO processes. The process I want to use the data in, and the process where I CRUD the data in the first place. It is not possible to do this in one process.
And by this I mean you may have to consider reviewing your process and redesigning them.
BDO wise
The way to get the DDL populated from the BDO is to REST call against a unique query (select DDL from listOfCountries order by persistanceID DESC), with a count of 1.
Database wise
the way to get the DDL populated is to use a combination of Javascript and AJAX as previously shown.
My problem to some extent is also that you started the question based on Oracle, now you are firmly in the BDM camp, and i think you’re trying to do too much in one process when it would be better designed as two simpler ones.
regards
Seán