Getting **defined** process user tasks and task attributes

I was wondering if it is possible to retrieve the user tasks defined in a deployed process (not and instantiated one).
Currently, the only solution I can think of is to:

  • Add a category to user tasks
  • Retrieve the process definition model (extremely huge object)
  • Filter objects in the mainProcess.flowElements array for objects that have a category matching the required category.

It’s all to aid in dynamically creating a menu of possible user tasks defined for a process.

The other question is that I notice that the flow elements has an attributes property but is always empty in my instances. I’ve looked in the modeler and I’ve searched in the documents but don’t know the why of this property or how it can be populated.

The approach you describe sounds like the way to go: you need to mark the user tasks somehow, if you can’t show them all on the screen. Note that the BpmnModel is always cached in-memory and that the filtering also will happen in-memory. Even if it’s a big process definition, this is very fast.

Not sure which one you’re referring to. Do you have an example?

{
....,
 "flowElements": [
            {
                "id": "centralStartEvent",
                "xmlRowNumber": 5,
                "xmlColumnNumber": 5,
                "extensionElements": {},
                "attributes": {}, <--------------- This one
                "name": null,
                "documentation": null,
                "executionListeners": [],
                "asynchronous": false,
                "notExclusive": false,
                "incomingFlows": [],
                "outgoingFlows": [
                    { ... }
                ],
                "eventDefinitions": [],
                "initiator": "initiator",
                "formKey": null,
                "validateFormFields": null,
                "formProperties": [],
                "interrupting": true,
                "exclusive": true
            },
....
}

Looking at the code, they seem to be extension attributes. Meaning, if you have custom attributes (different xml namespace) in your xml, they’ll end up there. But there’s no possibility to set these in the Modeler, only programmatically or in XML.