# 一覧画面のフィールドがundefinedエラーになる

**URL:** <https://community.cybozu.dev/t/topic/4653>\
**Category:** kintone 開発相談\
**Created:** [2019 年 12 月 5 日午前 7:22 UTC](https://community.cybozu.dev/t/topic/4653 "2019-12-05T07:22:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Legacy\_Account862](https://avatars.discourse-cdn.com/v4/letter/l/f08c70/32.png) [@Legacy\_Account862](https://community.cybozu.dev/u/Legacy_Account862)\
**Post date:** [2019 年 12 月 5 日午前 7:22 UTC](https://community.cybozu.dev/t/topic/4653/1 "2019-12-05T07:22:41Z")

</div>

あるフィールドを編集不可にしたく、以下のようなjsを作成しました。

詳細画面では上手く、編集不可になるのですが、

一覧画面では編集できてしまいます。

consoleには以下のようなエラーが表示されていました。

index.js:975 Uncaught TypeError: Cannot read property ‘lent\_Status’ of undefined

そもそも一覧画面での編集を無効にしたいのですが、よい方法がありましたらご教授ください。

よろしくお願いします。

* * *

(function () {  
“use strict”;

var events = [  
‘app.record.index.edit’,  
‘app.record.index.show’,  
‘app.record.detail.show’,  
‘app.record.edit.show’,  
‘app.record.create.show’,  
];

kintone.events.on(events, function(event) {

var record = event.record;

record[‘lent\_Status’].disabled = true;  
return event;

});

})();

&nbsp;

&nbsp;

---

<div class="post-metadata">

**Author:** ![Legacy\_Account1051](https://avatars.discourse-cdn.com/v4/letter/l/9de053/32.png) [@Legacy\_Account1051](https://community.cybozu.dev/u/Legacy_Account1051)\
**Post date:** [2019 年 12 月 5 日午前 8:55 UTC](https://community.cybozu.dev/t/topic/4653/2 "2019-12-05T08:55:18Z")

</div>

app.record.index.showだけevent.recordsというプロパティなのでエラーが出てるのだと思います。

対象イベントを下記に変えてみてください。

```
var events = [
'app.record.index.edit.show',
'app.record.detail.show',
'app.record.edit.show',
'app.record.create.show',
];

```

---

<div class="post-metadata">

**Author:** ![Legacy\_Account862](https://avatars.discourse-cdn.com/v4/letter/l/f08c70/32.png) [@Legacy\_Account862](https://community.cybozu.dev/u/Legacy_Account862)\
**Post date:** [2019 年 12 月 6 日午前 1:30 UTC](https://community.cybozu.dev/t/topic/4653/3 "2019-12-06T01:30:35Z")

</div>

[TK](https://community.cybozu.dev/hc/ja/profiles/379429477971-TK)様

早速のご教授ありがとうございます。

確認が遅れまして大変失礼いたしました。

頂いたコードで修正しましたらエラーも消えて修正不可になりました。

勉強不足でお恥ずかしいです。助かりました。
