Add custom rules


#1

Hello dear friends.
I’m new in programming and I try to add custom rules to modeler.
I read documentation but I don’t understand how can I do it.
Please tell me in easy steps how can I add rules to modeler.
Thanks you very much.


#2

The example shows you exactly what to do in order to add you custom rules

  1. Create a custom RuleProvider
  2. Add your custom rules

All that’s left to do is to use your custom rules in the modeler.

var customRulesModule = require('./custom-rules');

var modeler = new BpmnModeler({
  container: '#canvas',
  additionalModules: [
    customRulesModule
  ]
});

#3

Thanks for the above info.

I tried using the code you have provided but its not adding the custom rules as I am still able to use palette elements with default rules.

import $ from 'jquery'; import BpmnModeler from 'bpmn-js/lib/Modeler'; import CustomRules from './custom-rules';

$(() => {
var modeler = new BpmnModeler({
container: ‘#canvas’,
keyboard: {
bindTo: document
},
additionalModules: [
CustomRules
],
height: “75%”
});
modeler.createDiagram();
});

Anything extra needed to be done here ?


#4

I found that the default rules are being applied before custom rules.
How can load and apply custom rules just before default Bpmn rules?


#5

Please do not necrobump old topics. Instead link to this thread from new topic.


#6