Check previons run of process based on process java object variable

Hi!
I some thouse model:


I have some limitation policy for users based on process variable and current date. For example users cant run more than 25 instances in day with variable “Food”, java.object, where Food.Delivered == true.
I understand that i need to make some querys to HistoryService in my “Check policy”, but i cant figure out how query complex object in history and work fith thouse atributes.
Can you give me some direction or examples?

Take a look at this: Limit number of concurrently running instances of a process definition. Basically the same idea. You can apply this logic through on your timer. So you don’t need the extra steps if you don’t want them.

You would basically be doing a history service variable query getting the variables for the specific process instance.