Pass custom attributes in Script Task

Hi,

How can I add custom attributes like customKey below to the scriptTask or any task in XML process definition?

<scriptTask id="<id>" name="<name>" flowable:async="true" flowable:exclusive="false" flowable:customKey="myValue">

I see that this works well in UserTask, ie. custom attributes get set in FlowNode.attributes as key and value. Refer: https://github.com/flowable/flowable-engine/blob/eeebfd23af3571741b60e3f663f17c0ecc50a812/modules/flowable-bpmn-converter/src/main/java/org/flowable/bpmn/converter/UserTaskXMLConverter.java#L147

But the same with different task types, like script task is not happenning. Is there a way to customize this behaviour in XML parsing?

Hi,

If you add BpmnXMLUtil.addCustomAttributes(... to ScriptTaskXMLConverter it should add custom attributes to the script task. Custom properties must also added to the moduleā€¦
What is not clear to me is how will you use these custom attributes in the script engine execution. You can easily add them to the script if you want to.

Regards
Martin

Is there a way I can add this change and set it as converter in configuration? Since ScriptTaskXMLConverter is in flowable code, I need a way to override/add addCustomAttributes method to this converter.

I am making some custom changes in execution where I have access to FlowNode and thus I can get attributes from it.

I did not find an easy way how to do it.