お世話になります。
アプリA と アプリBのユーザ選択の更新がうまくいきません。
アプリA と アプリBのそれぞれユーザ選択を配置しています。
アプリAに受注番が入力、または更新時に、
アプリAに設定されているユーザを アプリBのユーザ選択部に更新したいのです。
下記、プログラムですと、
Cannot read property ‘value’ of undefined にて、担当者の部分でエラーになります。
解決策をお力添え願います。
(function() {
"use strict";
var events = ['app.record.create.show',
'app.record.create.change.受注No',
'app.record.create.submit',
'app.record.edit.submit',
'app.record.index.edit.show',
'app.record.edit.change.受注No',];
kintone.events.on(events, function(event) {
var record = event.record;
if (record['CardRec_No'].value === undefined){
return event;
}else {
var AppNo = 257;
var RecNo = CardRec_No;
var modbody = {
"app": AppNo,
"id": RecNo,
"record": {"案件担当者": {"value": [{code: record['担当者']['value'][0]['code']}]}
}
};
return kintone.api(kintone.api.url('/k/v1/record', true), 'PUT', modbody).then(function (resp) {
return event;
});
}
});
})();