Access custom table in DB

I’m using camunda on tomcat distribution and I changed the db to Postgres
I have an embedded form where data needs to be selected from a custom table in db,I created the table and put data in it, but I couldn’t find a way to access it from the form
I was able to retrieve the data in java delegate (using JDBC Statement) that i call in service task, it doesn’t help though because I need to use the data in the start form as a select input

Hi @kawtar.marref,

Are you using Camunda Tasklist for displaying the form?
Or do you have a custom Tasklist/Frontend?

Camunda Tasklist
If you’re using Camunda Tasklist, the start-form is rendered before the actual process is started. There is no easy way, to fill this form with values from a database. The common pattern would be to

  1. start the process without a form
  2. fetch relevant data from a database
  3. show the form with the data from the process data

Why do you want to do this during process start?

Custom Tasklist
With a custom tasklist you have way more flexbility.

Thanks for the quick response!
I’m using Camunda tasklist, the approach you’re suggesting seems logical but the custom table has more than 400 instances, I’m not sure if it’s ok to store that data in a process variable ?

Well, probably it would be better to not do it. How complex are these instances? What is expected of the user? They likely will not go manually through all 400 instances, do they?

The table has up to 10 attributs, the user will have a select dropdown with a search box, when a user selects an intance the details of that instance will be display below

I see. So, you’re not using Camunda Forms but an embedded form?
If so, you can add custom javascript. Then you could do the following: Write a service/rest-endpoint that talks to your database and your form.

That’s what I initially was trying to do, to create a custom rest endpoint, could you please give a hint on how I can do that keeping in my mind I’m using tomcat dist?

Hi,
checkout this thread:

and in particular this example by @felix-mueller:

Hello @StephanHaarmann , I already tried using the github custom-rest-api project but I couldn’t figure out how to configure it or how to add it in my tomcat distribution, I would truly appreciate if you could help me with that

Hi @kawtar.marref,
If I understand the linked thread correctly, the project is build for CDI compatible application servers. As far as I know, Tomcat does not support CDI out of the box :confused:

Hello, I actually found this article on medium that uses JAX-RS application to query the db Customizing and Extending Camunda Tasklist (Communication with External Sources) | by Hassan H Ghanem | Medium
I followed all the steps but when I test the api I get this error:
> Failed to load resource: the server responded with a status of 500 ()

1 Like

Maybe @hassang is able to help you

1 Like