Continuing the discussion from How to set Default values for Service Task property panels:
This Answer did help me a lot, so i was thinking this maybe the right approach for my question the other day, autopopulate-property-panel-on-dragging-name-description.
I followed the code for creating new service task,
function createTicket(event) {
const shape = elementFactory.createShape({ type: 'bpmn:ServiceTask','camunda:asyncBefore': true });
shape.businessObject["type"] = "external";
shape.businessObject["topic"] = "value 1";
shape.businessObject["name"] = "Create Ticket";
create.start(event, shape);
}
and the result is success.
NOW, i have other default values to load like,
![image](https://forum.bpmn.io/uploads/default/original/2X/9/99a7458f7ca64f8aa7c01f60e8166ac013982a47.png)
is this possible by same method,
if so, what should we code like similar to this ? (ex. : shape.businessObject[“name”] = “Create Ticket”; )
1 Like
Creating execution listeners and other complex properties generally works the same.
const executionListener = moddle.create('camunda:ExecutionListener', {
expression: 'foo'
});
executionListener.$parent = extensionElements;
extensionElements.set('values', [ executionListener ]);
I could finally get the execution listener and extension properties auto populating by the code below
// this can set the values of extension properties and
// execution listeners when passed through the function itself...
import { PropertiesPanel } from "@bpmn-io/properties-panel";
export default class CustomPalette {
constructor(create, elementFactory, palette, translate, elementRegistry, moddle, modeling) {
this.create = create;
this.elementFactory = elementFactory;
this.translate = translate;
this.elementRegistry = elementRegistry;
this.moddle = moddle;
this.modeling = modeling;
palette.registerProvider(this);
}
getPaletteEntries(element) {
const {create,
elementFactory,
translate,
moddle,
modeling,
} = this;
function createUserTask2(event) {
const shape = elementFactory.createShape({ type: 'bpmn:UserTask' });
shape.businessObject["name"] = "Created User";
shape.businessObject["id"] = "CreatedUser";
var extensionElements = shape.businessObject.get('extensionElements');
if (!extensionElements) {
extensionElements = moddle.create('bpmn:ExtensionElements');
}
const executionListener = moddle.create('camunda:ExecutionListener', {
class : 'check',
event: 'end'
});
const properties = moddle.create('camunda:Properties');
const property = moddle.create('camunda:Property', {
name: 'hello',
value: 'jiii'
});
properties.set('values', [ property ]);
extensionElements.set('values', [ properties,executionListener ])
shape.businessObject["extensionElements"] = extensionElements;
create.start(event, shape);
}
return {
'create.user-task2': {
group: 'activity',
className: 'bpmn-icon-user-task',
title: translate('Created User'),
id: 4,
action: {
dragstart: createUserTask2,
click: createUserTask2
}
},
}
}
}
CustomPalette.$inject = [
'create',
'elementFactory',
'palette',
'translate',
'elementRegistry',
'moddle',
'modeling'
];
@philippfromme Thanks much for help
1 Like
system
Closed
4
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.