Creating custom subProcess as atomic operation

Hi Guys,
how i can achieve creating a custom subProcess structure as atomic operation/command.
for example this is the desired sub process i want to create
image

currently what i was trying to do is creating a custom CommandHandler and execute the command on a custom trigger from the context pad.

but the issue i was not allowed by the framework to execute more than one command in the execute method.
so to solve it i did it in the postExecute method.

it feels to me its kind of a workaround, i was wondering if there is a better solution.

is there a better solution ?

That’s exactly how it’s supposed to be done. You can create a command handler and use its postExecute method to compose multiple commands as one. This is being done in various places in the toolkit. :wink:

To add up to what @philippfromme elaborated on:

postExecute('create.subProcess', function() {
  modeling.createElement('...');
  modeling.createElement('...');
  modeling.createElement('...');
  modeling.createElement('...');
  modeling.createElement('...');

  modeling.connect(...);
});

this is what i did exactly :slight_smile:
thanks for the help