How to update XML when attributes changed pragmatically in service task?


#1

i am able to update service task properties in properties panel but that changes are not reflecting in XML. my custom menu provider code is like below.

     private setModelerTemplateValue(element: any, elementShape: any) {
        this.selectedTaskId = element.delegateTarget.getAttribute("data-id")
        elementShape.businessObject.set("camunda:modelerTemplate", this.selectedTaskId + "-customTask");
     }

    getEntries(element) {
        let result = super.getEntries(element);
        var replaceElement = this.bpmnReplace.replaceElement;
        var replaceAction = (event) => {
            this.setModelerTemplateValue(event, element);
            return replaceElement(element, {
                type: 'bpmn:ServiceTask'
            }
            );
        };
        var action = action || replaceAction;
        if (element.type && element.name == "customTask") {
            let group = this.taskGroupJson.find(item => item.groupName === element.groupName);
            if (group && group.tasks) {
                element.businessObject.set("rtName", group.groupName)
                element.businessObject.set("id", group.groupName);
                element.rtName = group.groupName;
                let taskActions = [];
                group.tasks.forEach(item => {
                    taskActions.push(
                        {
                            label: item.taskName,
                            className: item.iconName,
                            id: item.id,
                            target: {
                                type: item.type,
                            },
                            action: action
                        }
                    )
                });
                result = taskActions;
            }
        }
        return result;
    }

Capture
like in above image custom fields are loading in diagram but those are not available in XML.
please suggest me is there any event to trigger to update the XML?