Getting information from Camunda Database

Hello everyone,

How can I recover/ get information about process instances that are running or has been ended from Camunda database by using Camunda API?

for example, if I have an order system and I want to get variables values from database that belongs to specific customer name, values like customer credit card or customer type. These values are in Camunda’s database from previous process instances and I want to get back these values by using Camunda’s API?
Or how can I do that by using camunda-exteral-task

how can I do that?

Hey @Yazan!
If you are using Camunda 7 you can easily rely on the history API for such purposes. You should use it when your process instance is already completed and you want to gather some more information.

To also give a thought to the example you have mentioned:
You can always persist variables like customer credit or type in your domain database right away in your service task.
Maybe this guide gives you a good understanding how to handle data in processes: Handling data in processes | Camunda Platform 8

Let me know how I can support you further!
Best,
Thomas

Hello @Hafflgav
I’am using Camunda 7,
if i used history API can gather variable’s values for process instances that have been completed?
as an example, customer has type, credit card, adress, mail and phone.
With using history API can I getting back these information from competed process instance?

Hey @Yazan,
yes you should be able to retrieve variables from already completed process instance.
Take a look here:

If you know the variable instance ID you can easily query for the value even though the process instance has ended.

I can recommend checking out the other queries in there to learn how to retrieve variable IDs for certain process definitions and instances.

Best,
Thomas

Hello @Hafflgav
How can I know variable instance ID?
Thank you