参照元の関連レコードの日付データを参照先のフィールドにセットしたいのですが、参照先の日付フィールドはデフォルトのままです。
原因と解決策をご教示いただけますでしょうか。
(function() {
“use strict”;
const events = [
// 関連レコードが更新されたタイミング
‘app.record.create.change.relationRecord’
]
kintone.events.on(events, function(event) {
// まず、アプリのフィールド設定を取得しておく
RelatedRecordsFieldManager.prototype.getFieldProperties().then(function() {
console.log(RelatedRecordsFieldManager.prototype.fieldProperties);
// 関連レコードの日付フィールドの値を取得する
(new RelatedRecordsFieldManager(‘relationRecord’)).getRecords(event.record).then(function(records) {
console.log(records);
// startに関連レコードの値を表示
event.record.start.value = records.reduce(function(record) {
return Date(record.relationRecord.value);
})();
});
});
});
// コンストラクタ定義
})();