Hook for the moment when a user enters the title on a new activity?

I am adding an autocomplete function (using jquery ui), so when a user adds a new activity, they can select the title from a pre-existing list. This works fine.
However, I’d like to set the element-id of the new activity so it matches my pre-existing texts.
Is there a method that gets called when a new activity is created, right after the user enters the title of the activity?

The DirectEditing module is firing some events you can hook into, e.g. on complete

const eventBus = modeler.get('eventBus');

eventBus.on('directEditing.complete', function(context) { ... } );
1 Like

Thanks for the answer. The ‘context’ parameter received by the complete function only seems to have 2 attributes: active and type. Is there a way to get a reference to the element being edited?

I think on directEditing.complete the edited element is already gone, as it is completed. What you could do is to listen for .activate instead and save the element for which direct editing has been started.

eventBus.on("directEditing.activate", function (event) {
  console.log(event.active.element);
});
1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.