How to write on database at the end of a process? [SOLVED]
Hi, I am using Bonita BPM and i developed an API extension. I also added a postgres db storing business data (products and so), leaving to Bonita the process handling.
My environment involves two processes:
- the main process
- a subprocess
My issue is the following:
what's the right way to trigger an update to my database each time the subprocess instance is completed? I would like to, say, change the state of the product involved in the subprocess.
From the documentation, I can't get whether I should make use of a connector or a event handler, or something else.
Thank you for your help
I always use a connector. much easier...
regards
Seán
PS: If this reply answers your question, please mark a resolved.
Comments
Thank you Sean. I'm configuring the connector out for the final subprocess activity right now. How can i use the subprocess variables to customize my query? Let's say i have a process variable "product_id" and i want to update the record like "UPDATE products SET state='completed' WHERE product_id = (%product_id)".
Thank you, it worked!
Comments
If your "product" is stored using Bonita BPM Business Data feature the way to go is to define a service task at the end of the sub process and on the service task define an operation.
If you use an external database (not managed by Business Data) I suggest to use a database connector as recommended by Sean. Use the data source connector with a connection pool configuration to ensure performance.
Thank you antoine, I think a database connector is the win. I have now the issue of customizing my query based on the process variables. I explained it better answering Sean