Query regarding statuses [Process,Task,Custom]

cancel
Showing results for 
Search instead for 
Did you mean: 
sonalik
Member II

Query regarding statuses [Process,Task,Custom]

Hi Team,

I have few queries regarding process statues, task statues, custom statues...

I have listed down the requirement,

1. fetch all processes as well as tasks whose status="In Progress"

2. Ability to add custom statuses. For example status workflow for a process can be e.g.Started->InProgress->Send to Customer->Send to Manager->Sent for Approval 1->Sent for Approval 2->Completed->Closed.

After going through the tables (25 tables which are created as part of activiti) i was not able to find out any status related column neither for process nor for task. Does this mean there is not direct status related data stored in tables? And we have to play with the start/end times to actually decide whether the process/task got started/completed. Also need to additionally maintain some variables at process level and task level in order to track the status. Please confirm our understanding and also suggest in case of any better approach?

Looking forward for your support. Thanks in advance.

--Sonali

1 Reply
jearles
Established Member II

Re: Query regarding statuses [Process,Task,Custom]

Sonali,

I think, at a conceptual level what you're asking for certainly makes sense - but also consider that, when using a BPM engine more or less 'correctly', those things should be indicated simply by viewing the current process step in the execution context.

Take the following workflow for example:

There are a couple of notable things:

  • The Process Diagram is clearly drawn.
    • This allows for a regular user to view the diagram.
  • The Task names are coherently labeled and distinguishable.
    • This allows a regular user to understand what is happening, even though you may be doing some complex things under the covers.
  • The Flow arrows are actually labeled.
    • which allows you to query on those names in the historical database.

When you view the process execution, there isn't really a need for a process status. You should be able to look at the current task and say: "Okay, so we're currently clarifying the invoice for the customer", and you'll be able to react to that. While statuses could be helpful and useful; in my mind, that notion deters from the original intention of BPMN, and BPM engines - which is to clearly establish an executable process that can be understood by both the developers and the business.

You can add as much custom logic as you need on the backend, but if you name your steps coherently and in a way that clearly lays out your intentions, a regular business user should be able to understand exactly what is happening and where the process execution is currently sitting. You could honestly display the current task that a process is on, and that would be sufficient to give someone an idea of what is happening.


Anyway:

As for fetching processes that are "In Progress" or given a certain status; well, in Activiti, a process is still 'running' unless it has an END_TIME_ set in the database - so you could simply query for all processes without an END_TIME_ set. And for the custom status queries, simply query for tasks given a certain name, or processes that are currently on a given task.

Cheers,
-JEarles