Uploaded image for project: 'camunda BPM'
  1. camunda BPM
  2. CAM-9732

I can find all instances of the latest process definition version

    Details

    • Type: Feature Request
    • Status: Open
    • Priority: L3 - Default
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: engine
    • Labels:
      None

      Description

      AT

      • via process instance query, I can find all instances of the latest definition version with an option like latestProcessDefinition() or something similar
      • via process instance query, I can find all instances with definition versions except the latest one with an option like notLatestProcessDefinition() or something similar
      • the same should be available for historic process instance queries

      With Query API options like those, it would for example be easy to abort/delete all (historic) process instances that do not have the latest version of the definition, without having to go through a workaround of something like:

      // get the definitions, latest one first
      List<ProcessDefinition> definitions = repositoryService.createProcessDefinitionQuery()
          .processDefinitionKey("aDefinitionKey")
          .orderByProcessDefinitionVersion().desc()
          .list();
      // delete instances, start with the second definition to skip the latest one
      for (int i = 1; i < definitions.size(); i++) {
        ProcessInstanceQuery instanceQuery = runtimeService.createProcessInstanceQuery().processDefinitionId(definitions.get(i).getId());
        runtimeService.deleteProcessInstancesAsync(instanceQuery, "aReason");
      }
      

      The extension would allow to condense this to something like:

      // delete instances except for the ones with latest definition version
      ProcessInstanceQuery instanceQuery = runtimeService.createProcessInstanceQuery().notLatestProcessDefinition();
      runtimeService.deleteProcessInstancesAsync(instanceQuery, "aReason");
      

      The forum entry that brought this up in a sense can be found here.

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            Unassigned
            Reporter:
            tobias.metzke Tobias Metzke
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:

              Development