Hello,
Im using bpmn.io on my angular 9 project and it work like well.
But i want to automate some things, like filling automatically the inputs on the moment when i add a task to the canvas.
Can anyone help me with any information about this?
Thans in advance.
So you want a task to be created with some default properties?
yes, i want that all task that i created, (or later i can filter them) i want to have the same properties Script.
Hi @EditAxha,
I created a modeler plugin that adds predefined and connected elements to the canvas: https://github.com/ingorichtsmeier/camunda-modeler-plugin-connected-elements.
As I’m not a JavaScript expert, I can’t tell that this will work in an angular 9 project as well. But it’s worth to have a look.
Hope this helps, Ingo
You can use a CommandInterceptor that will add the execution listener before an element is added to the diagram: https://codesandbox.io/s/add-executionlistener-through-behavior-example-w06fd
this.preExecute(
"elements.create",
LOW_PRIORITY,
function (context) {
console.log("elements.create", context);
context.elements.forEach(function (element) {
if (is(element, "bpmn:Task")) {
const { businessObject } = element;
const camundaScript = bpmnFactory.create("camunda:Script", {
scriptFormat: "groovy",
resource: "test",
value: "test",
});
const executionListener = bpmnFactory.create(
"camunda:ExecutionListener",
{
event: "start",
script: camundaScript,
}
);
if (!businessObject.extensionElements) {
const extensionElements = bpmnFactory.create(
"bpmn:ExtensionElements",
{
values: [],
}
);
businessObject.extensionElements = extensionElements;
extensionElements.$parent = businessObject;
}
businessObject.extensionElements.values.push(executionListener);
executionListener.$parent = businessObject.extensionElements;
}
});
},
true
);
Thanks a lot for your help. my final code is this, it fill with scripts data the inputs.
I want to set the Executable of the process to true as default,
Can you help me with this?
Thanks a lot.
For new questions please open a new topic.