Skip to main content

Send Message notifications to employees selected by the subform member component

1. Case Background

At the current stage, the YIDA message notification function cannot directly send messages to employees selected by the subform member component, in this example, the JS code assigns the data selected by the subform member component to the main table member component to send a message notification to the selected employee of the subform member component.

2. Procedure

2.1 Step 1: form design

  1. Create a member selection form and add a subform component that contains member components and a member component.

Page layout design

  1. Bind actions to the subform member component to assign the selected data to the main form Member component.

Binding actions of child table member components

Note:The code involved is as follows,Pay attention to the replacement of the unique identifier of each component during use.

export function onChange({ value }) {
setTimeout(() => {
//获取整个子表单数据
// tableField_l24evei6 为子表单的唯一标识,使用时应进行替换。
let text = this.$("tableField_l24evei6").getValue()
let temp = {}//创建一个空对象
//通过循环将子表单中的数据取出,重复的人员进行去重
for (var i in text) {
//判断子表单成员组件是否是数组对象格式,如果是再次进行循环取出成员组件对应选择的人员,如果是对象的格式就直接取出选择的人员。
//注意 employeeField_l24evei7 为子表单成员组件唯一标识,使用时应注意替换。
if (Array.isArray(text[i].employeeField_l24evei7)) {
text[i].employeeField_l24evei7.map((item) => {
let key = item.label;
if (!temp[key] && item.value != undefined) {
temp[key] = {};
temp[key].value = item.value;
temp[key].label = item.label;
}
})
} else {
let key = text[i].employeeField_l24evei7.label;
if (!temp[key] && text[i].employeeField_l24evei7.value != undefined) {
temp[key] = {};
temp[key].value = text[i].employeeField_l24evei7.value;
temp[key].label = text[i].employeeField_l24evei7.label;
}
}
}
let newArry = []
for (var k in temp) {
newArry.push(temp[k])
}
// employeeField_l24evei8 为主表成员组件唯一标识,使用时应注意替换。
this.$("employeeField_l24evei8").setValue(newArry)

}, 1000)
}

2.2 Step 2: Configure message notifications

Configuration path:Page Setup> message notification> Create message notification> select a job notification template> Enable More Settings> send to form fields-Members> Click OK.

Message notification configuration

3. Effect display

Submit form

Message notification



This doc is generated using machine translation. Any discrepancies or differences created in the translation are not binding and have no legal effect for compliance or enforcement purposes.
Copyright © 2024钉钉(中国)信息技术有限公司和/或其关联公司浙ICP备18037475号-4