How to access the signals list from a custom palette?


I would like to develop a custom palette button that creates a specific Signal StartEvent, with the signalRef pre-defined.

This post has been quite helpful: SignalEventDefinition Creation

However, I would like to get the list of signals from my custom palette code. In the code provided in that post, the signal list is obtained from the renderer (i.e. the BpmnJS instance), but from another place than the palette code itself.

So my question is: how can I retrieve the list of signals from the palette code (i.e. the getPaletteEntries function)?

One solution would be to access the renderer from the palette, but I don’t see how to get that.

Many thanks!

I have found a solution, but I am not sure this is the best approach, can you please tell me?

Thanks to Access to ElementRegistry from CustomContextPadProvider I use the dependency injection to load the canvas from the custom palette.

CustomPalette.$inject = [

Palette constructor:

export default class CustomPalette {
  constructor(bpmnFactory, create, elementFactory, palette, translate, canvas) {

And finally:

        var definitions = canvas.getRootElement().businessObject.$parent;
        var signalsList = definitions.rootElements.filter(function(element) {
              return element.$type === 'bpmn:Signal';

Best rgrds

You get all the signals from the root element, that’s the way I’d probably also do it. :+1:

1 Like

We have helpers in place to do similar things, without the canvas, but getting the root via any element.

const signals = findRootElementsByType(element, 'bpmn:Signal');
1 Like