Properties Panel - Textfield entry with manual text value


#1

Hi there,

I’m currently trying to accomplish a rather simple sounding task:

Have an e.g. text field entry show the value of a given variable.

I have a variable ‘someVariable’ which contains ‘foo’ as a string and I want that to show up when opening the tab containing that text field.

Taking properties-panel-extension as my go-to example I tried the following:

[...]
module.exports = function (group, element) {

// Only return an entry, if the currently selected
// element is a start event.

var someValue = "foo";

if (is(element, 'bpmn:StartEvent')) {
    group.entries.push(entryFactory.textField({
        id: 'test',
        description: 'testing',
        label: 'manual text',
        get: function (element) {
            console.log('getTest', element);
            return someValue;
        },
        set: function (element, values) {
            console.log('setTest', element, values);
            someValue = values;
        }
    }));
}
};

Thanks for any help!


#2

Well… seems it helps to read the definitions of used ‘entryFactory’ functions. Turns out I understood the ‘modelProperty’ all wrong. It defines the resulting form’s ‘name’ tags. Thought it had something to do with the underlying moddle which isn’t present in my case since I don’t want to persist my data in the bpmn-xml.

Cheers