I can't figure out what the custom rules example does

Continuing the discussion from Some questions about some specific needs and whether bpmn-js can ensure them:
Continuing the discussion from Add custom rules:

I tried adding this custom rules example on my angular app everything seems fine, but I’m not sure if it works or not, as I’m quite not sure what this custom rules is supposed to do exactly.
I used the exact same code (same custom rule provider) added it to my bpmn modeler:

import * as BpmnJS from 'bpmn-js/dist/bpmn-modeler.production.min.js';
//import * as customRules from './customRule';
import CustomRules from './customRuleProvider';
constructor(private http: HttpClient) {
    this.bpmnJS = new BpmnJS({

I’m loading this xml bpmn file at start:
I tried removing and readding the attribute vendor:allowDrop=“bpmn:Task” but I can’t see any difference.

EDIT: Added my code to a sandbox you can find it here


I took a look at your sandbox, and you seem to be importing the wrong file.
The file declaring your custom rules module is customRule.js, not customRuleProvider.js


1 Like

Thanks for the reply,
I tried that first but changed it, (the commented line right above it, that’s why I left it).
But I dont think it works either, I tried a lot of things but my console.log in the customRuleProvider never executes it seems no matter what I try.
Also I’m not certain what this rule example does exactly so even then, I can’t tell if it works or not.

I just checked again, so, in the current state of your sandbox :

edit line 25 from

import * as customRules from "./customRule";


import customRules from "./customRule";

Then reload and try dragging any element from the palette. You should see your logs in the console.

1 Like

Thank you, that solved it for me.
Another quick question if I understand correctly these rules are like event listeners and get triggered when the action happens (in this case shape.create?).
So is there a list of the ‘shape.create’ like actions to pick from?

Is there a specific behavior you want to listen to, or were you looking to see all of them?
Because, no, we don’t have an exhaustive list yet.

1 Like

I described the global wanted behavior in a recent topic:
Some questions about some specific needs and whether bpmn-js can ensure them.
But to make it brief, I want to have a startEvent and endEvent element that are irremovable (so I’m guessing I have to add them in my initial xml and give them an attribute and use a remove or delete action similar to this example?)
I only want 1 startEvent and 1 endEvent (the ones initially generated) and wouldn’t need anymore (I think removing eventStart and eventEnd from the context pad and palette would do the trick and the user wouldn’t be able to add any)