I am trying to create a custom task called so that it can be saved in the XML file as
aws:AwsTask
but I am getting the following error
Uncaught Error: cannot create <aws:AwsTask> extending <bpmn:Task>
what I did to reach this issue is
first, I modified the ReplaceOptions.js file and added the following
{
label: 'Aws task',
actionName: 'replace-with-Aws-task',
className: 'bpmn-icon-script',
target: {
type: 'aws:AwsTask'
}
},
then I modifed BPMNRenderer.js file and added the following code
'aws:AwsTask': function(parentGfx, element, attrs = {}) {
attrs = pickAttrs(attrs, [
'fill',
'stroke'
]);
var task = renderTask(parentGfx, element, attrs);
var x = 15;
var y = 12;
var pathDataUser1 = pathMap.getScaledPath('TASK_TYPE_USER_1', {
abspos: {
x: x,
y: y
}
});
drawPath(parentGfx, pathDataUser1, {
fill: getFillColor(element, defaultFillColor, attrs.fill),
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
strokeWidth: 0.5
});
var pathDataUser2 = pathMap.getScaledPath('TASK_TYPE_USER_2', {
abspos: {
x: x,
y: y
}
});
drawPath(parentGfx, pathDataUser2, {
fill: getFillColor(element, defaultFillColor, attrs.fill),
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
strokeWidth: 0.5
});
var pathDataUser3 = pathMap.getScaledPath('TASK_TYPE_USER_3', {
abspos: {
x: x,
y: y
}
});
drawPath(parentGfx, pathDataUser3, {
fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
strokeWidth: 0.5
});
return task;
}
then I created a file called AwsTask.json with the following content
{
"name": "AwsTask",
"uri": "http://aws",
"prefix": "aws",
"xml": {
"tagAlias": "lowerCase"
},
"types": [
{
"name": "AwsTask",
"extends": [
"bpmn:Task"
],
"properties": [
{
"name": "suitable",
"isAttr": true,
"type": "Float"
}
]
},
{
"name": "AnalysisDetails",
"superClass": [ "Element" ],
"properties": [
{
"name": "lastChecked",
"isAttr": true,
"type": "String"
},
{
"name": "nextCheck",
"isAttr": true,
"type": "String"
},
{
"name": "comments",
"isMany": true,
"type": "Comment"
}
]
},
{
"name": "Comment",
"properties": [
{
"name": "author",
"isAttr": true,
"type": "String"
},
{
"name": "text",
"isBody": true,
"type": "String"
}
]
}
],
"emumerations": [],
"associations": []
}
finally, in the app.js file
I added the following.
import awsTaskPackage from '../resources/AwsTask.json';
.........
var bpmnModeler = new BpmnModeler({
container: '#js-canvas',
propertiesPanel: {
parent: '#js-properties-panel'
},
additionalModules: [
BpmnPropertiesPanelModule,
BpmnPropertiesProviderModule,
BpmnColorPickerModule,
],
moddleExtensions: {
awsTask:awsTaskPackage
},
});
The new task appears when clicking the wrench icon on a normal task
But once clicked, I got the error mentioned before.
Thank you for your help
cheers