camunda / camunda-bpm-platform

Flexible framework for workflow and decision automation with BPMN and DMN. Integration with Quarkus, Spring, Spring Boot, CDI.
https://camunda.com/
Apache License 2.0
4.03k stars 1.53k forks source link

Drag&Drop Modify with collapsed subprocess with more than one process instance don´t work #4322

Closed venetrius closed 2 weeks ago

venetrius commented 2 months ago

Environment (Required on creation)

Reproduces issue on Tomcat distro on version 7.20.4, 7.20.5 and 7.21.0

Description (Required on creation; please attach any relevant screenshots, stacktraces, log files, etc. to the ticket)

User can't use drag and drop functionality for collapsed subprocess to start instance before/after an other step.

Steps to reproduce (Required on creation)

Observed Behavior (Required on creation)

After following the above steps, modification/executeAsync endpoint returns

{
    "type": "InvalidRequestException",
    "message": "For instruction type 'cancel': 'activityId' must be set",
    "code": null
}

Expected behavior (Required on creation)

Should successfully send a modification/executeAsync which creates a batch job after the batch job run the tokens are in the user task

Root Cause (Required on prioritization)

webapps/camunda-webapp/plugins/frontend/plugin/cockpit/modification/app/diagramPlugins/definitionModification.js

In onDragAndDrop we are checking if the element.id is present as a key in the activityIdToInstancesMap to see if it is a multi instance and then we set the id. However activityIdToInstancesMap does not contain collapsed subprocess. This id is used to create the cancel action. When creating the request the empty field is filtered out this is how we end up with the For instruction type 'cancel': 'activityId' must be set error.

I think this has never worked.

Solution Ideas

One simple fix is to check if the element type is bpmn:SubProcess then set MI to false and id to element.id

Hints

Links

https://jira.camunda.com/browse/SUPPORT-17986

Breakdown

### Pull Requests
- [ ] https://github.com/camunda/camunda-bpm-platform-ee/pull/933
- [ ] https://github.com/camunda/camunda-bpm-platform-ee-maintenance/pull/486
- [ ] https://github.com/camunda/camunda-bpm-platform-ee-maintenance/pull/485

Dev2QA handover

venetrius commented 2 weeks ago

Note to QA: @gbetances089 you should be able to follow the Steps to reproduce and see that it works properly. Let me know if you have any question.

tasso94 commented 2 weeks ago

@venetrius can you please replace the potential with the version labels?

gbetances089 commented 2 weeks ago

Verified on camunda-bpm-run-ee-7.22.0-20240625.173034-46