# お知らせで表示している一覧で、レコードを削除させない方法

**URL:** <https://community.cybozu.dev/t/topic/6196>\
**Category:** kintone 開発相談\
**Created:** [July 26, 2022, 6:07am UTC](https://community.cybozu.dev/t/topic/6196 "2022-07-26T06:07:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Legacy\_Account909](https://avatars.discourse-cdn.com/v4/letter/l/b2d939/32.png) [@Legacy\_Account909](https://community.cybozu.dev/u/Legacy_Account909)\
**Post date:** [July 26, 2022, 6:07am UTC](https://community.cybozu.dev/t/topic/6196/1 "2022-07-26T06:07:14Z")

</div>

“app.record.detail.delete.submit”, “app.record.index.delete.submit” のイベントで、条件により削除不可の設定をいれているのですが、お知らせに表示させた一覧では、機能せず、レコードが削除できてしまいます。回避する方法はあるのでしょうか？ご教示いただけると幸いです。

お知らせに表示された一覧ですと、×のボタンで削除されてしまいますが、一覧や詳細画面では、機能します。

ソースは、

var events = [“app.record.detail.delete.submit”, “app.record.index.delete.submit”];  
&nbsp; &nbsp; kintone.events.on(events, &nbsp;async function(event) {  
&nbsp; &nbsp; &nbsp; &nbsp; var record = event[“record”];  
&nbsp; &nbsp; &nbsp; &nbsp; var v=0;  
&nbsp; &nbsp; &nbsp; &nbsp; if (record[“請求番号”][“value”] !== undefined ) {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  
&nbsp; &nbsp; &nbsp; &nbsp;const str = “system”;  
&nbsp; &nbsp; &nbsp; &nbsp; const code = { code: str };  
&nbsp; &nbsp; &nbsp; &nbsp; const appURL = kintone.api.url(“/v1/organization/users”, true);

await kintone.api(appURL, “GET”, code).then(function (resp) {  
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; const authorizer = kintone.getLoginUser().code;  
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (var j = 0; j \< resp.userTitles.length; j++) {  
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (resp.userTitles[j].user.code == authorizer) {  
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; v = 1;  
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }  
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(v===0){  
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; event.error = “採番後は削除できません。ITに依頼してください。”;  
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }  
&nbsp; &nbsp; &nbsp; }); &nbsp;&nbsp;  
&nbsp; &nbsp; &nbsp; &nbsp; }  
&nbsp; &nbsp; &nbsp; &nbsp; return event;  
&nbsp; &nbsp; });

&nbsp;

---

<div class="post-metadata">

**Author:** ![Legacy\_Account2476](https://avatars.discourse-cdn.com/v4/letter/l/c0e974/32.png) [@Legacy\_Account2476](https://community.cybozu.dev/u/Legacy_Account2476)\
**Post date:** [July 26, 2022, 6:43am UTC](https://community.cybozu.dev/t/topic/6196/2 "2022-07-26T06:43:51Z")

</div>

依田美代子 様

こんにちは。

簡単な回答で申し訳ないですが、スペースの他にポータル等のお知らせのに貼ったアプリでは、kintoneJavaScriptAPIは利用できません。

そのお知らせで削除等の操作を制御するには、kintoneの標準機能のアクセス権で制御する方が無難かと思いますよ。

---

<div class="post-metadata">

**Author:** ![Legacy\_Account909](https://avatars.discourse-cdn.com/v4/letter/l/b2d939/32.png) [@Legacy\_Account909](https://community.cybozu.dev/u/Legacy_Account909)\
**Post date:** [July 26, 2022, 6:48am UTC](https://community.cybozu.dev/t/topic/6196/3 "2022-07-26T06:48:55Z")

</div>

新屋様

ご回答ありがとうございました。了解しました。

&nbsp;

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex015/uploads/cybozu/original/1X/d5c841c3c5a6cb66eed514001c1b45147c9e1f4f.png) [@system](https://community.cybozu.dev/u/system)\
**Post date:** [November 1, 2024, 6:49am UTC](https://community.cybozu.dev/t/topic/6196/4 "2024-11-01T06:49:39Z")

</div>

Closed on November 1, 2024, 6:49am UTC

このトピックはベストアンサーに選ばれた返信から 3 日が経過したので自動的にクローズされました。新たに返信することはできません。
