Hello,
I am adding custom properties to elements. This is required so my back-end can parse the XML with a correct hierarchy. I managed to create them as an extension on existing elements with the XML as following:
<bpmn2:serviceTask id="Task_08atnyy" camunda:type="external" camunda:topic="runscript" camunda:runscript="CreateInvoice">
The runscript type only becomes available when the selected topic equals “runscript”, so this worked out pretty well.
Now, when selecting the CreateInvoice-Runscript, certain variables are needed to execute it. When creating the model, values are to be given to these. For example, an InvoiceNumber.
It is very likely that several variables need a value. To link this to the corresponding element, a list of variables is needed. When adding Form-Fields to a Start-Event, the list of fields look like this:
ExtensionElements supports this, but using it lets the user add and remove elements.
I have tried to replicate the functionality and syntax of camunda:formData with the list of camunda:formFields in it, but i have not been able to… Tried assigning values hardcoded but even then i do not see any result in the exported XML. If i can achieve this in a basic way, i can figure out the rest, but i need a little bit of help.
Where i am now
-
Duplicated some code from the FormProps
-
Hardcoding values into the variables
-
Using Formdata, its certain that this can be used to achieve it.
(I have tried like a million things, so i have no idea how far i’ve wandered off…):entryFactory.textField({ id: variabledata.name + "variablevalue1", label: 'Variable value', modelProperty: 'id', prefix: 'FormField', get: function (element, node) { var bo = getBusinessObject(element); return {FormField: bo.get('camunda:FormField')}; }, set: function (element, values, node) { var bo = getBusinessObject(element); var commands = []; var formData = elementHelper.createElement('camunda:FormData', {fields: [], businesskey: scriptname}, bo, bpmnFactory); commands.push(cmdHelper.updateBusinessObject(element, bo, {FormData: formData})); var field = elementHelper.createElement('camunda:FormField', {id: variabledata.name}, formData, bpmnFactory); if (typeof formData.fields !== 'undefined') { commands.push(cmdHelper.addElementsTolist(element, formData, 'fields', [field])); } else { commands.push(cmdHelper.updateBusinessObject(element, formData, { fields: [field] })); }
Looking forward to replies!
Cheers, Revlyn