関連レコード

お世話になっております

 

関連レコードの対象レコードが無い場合に、参照するレコードがありませんと表示されるのですが、この文字を変更もしくは非表示にする事は可能でしょうか

 

宜しくお願い致します

超ザックリやってみましたがどうでしょう。(要jQuery)

kintone.events.on(['app.record.detail.show', 'app.record.edit.show', 'app.record.create.show'], function (e) {
// テキストを書き換える
$('.reference_table-message-gaia:contains("参照するレコードがありません。")').text('任意の文字');
return e;
});

関連レコードの欄ごと消すには

kintone.events.on(['app.record.detail.show', 'app.record.edit.show', 'app.record.create.show'], function (e) {
// 関連レコードフィールドごと消す
$('.reference_table-message-gaia:contains("参照するレコードがありません。")').closest('.control-reference_table-field-gaia').hide();
return e;
});

こんな感じです。

レコードが重たかったりすると効かない場合がありますので、正確にやるためには
こちらなどを参照して、実際に関連レコードの読込元アプリのデータを取得して
その結果が0件であれば関連レコードフィールドの欄をゴニョゴニョする、
という流れがよいかと思います。

ご連絡ありがとうございます。

 

(function($) {
“use strict”;

kintone.events.on([‘app.record.detail.show’, ‘app.record.edit.show’, ‘app.record.create.show’], function (e) {
// テキストを書き換える
$(‘.reference_table-message-gaia:contains(“参照するレコードがありません。”)’).text(‘任意の文字’);
return e;
});

})(jQuery);

 

このようにしてみたのですが特に文章は変更の無いままでした、どちらかに記載間違いはございますでしょうか

楽をしようとしてすみませんでした。jQueryなし版にします。

 

テキストを書き換える版

(function () {
    'use strict';
    kintone.events.on(['app.record.detail.show', 'app.record.edit.show', 'app.record.create.show'], function (e) {
        const nodes = document.querySelectorAll('.reference_table-message-gaia');
        nodes.forEach((node) => {
            if (node.textContent === '参照するレコードがありません。') {
                node.textContent = '任意の文字列';
            }
        });
        return e;
    });
})();

 
 関連レコードごと消す版

(function () {
    'use strict';
    kintone.events.on(['app.record.detail.show', 'app.record.edit.show', 'app.record.create.show'], function (e) {
        const nodes = document.querySelectorAll('.reference_table-message-gaia');
        nodes.forEach((node) => {
            if (node.textContent === '参照するレコードがありません。') {
                node.closest('.control-reference_table-field-gaia').style.display = 'none';
            }
        });
        return e;
    });
})();

これでどうでしょうか?

もし動かなければブラウザでそのページを表示してキーボードのF12キーを押して
「コンソール」とか「Console」とか書いてあるタブをクリックして
赤い文字が出ていないか確認してみてください。

上記コードにて正常に動作致しました

貴重な情報を頂き、ありがとうございました