下記の通り、一覧画面からレコードを更新する際、上司欄が未設定(値が’-'ハイフン)の場合、チェックボックスにOKを選択しても、アプリでチェックボックスを強制的に未選択状態にして更新させたいのですが、うまく行きません。
現在、以下のコード内容で確認しておりますが、下記エラーでうまく行きません。
index.js:114 Uncaught TypeError: Cannot read properties of undefined (reading ‘value’)
at download.do?app=217&contentId=7742&jsType=DESKTOP&hash=2e193a64b01517992f7577729510f6961a914b4f:8:25
at index.js:243:501
at new bk (index.js:115:330)
at Sw (index.js:243:480)
at index.js:243:276
at e.m (index.js:117:224)
at sk (index.js:119:254)
at nk (index.js:119:137)
at bk.V (index.js:922:101)
at Uj (index.js:115:176)
上記要件を満たすためには、どうのようにコードを書きかえれば良いかご教示願います。
(() => {
'use strict';
kintone.events.on(['app.record.index.edit.submit'], (event) => {
const record = event.record;
// 更新要否のチェックと、更新が必要な場合の値を設定
if (record.checkbox_1.value.indexOf("OK") !== -1 && record.superior_1.value == '-'){
record.checkbox_1.value = [] ;
}
if (record.checkbox_2.value.indexOf("OK") !== -1 && record.superior_2.value == '-'){
record.checkbox_2.value = [] ;
}
if (record.checkbox_3.value.indexOf("OK") !== -1 && record.superior_3.value == '-'){
record.checkbox_3.value = [] ;
}
return event;
});
})();