LoginSignup
0
0

More than 5 years have passed since last update.

kintone プラグイン開発メモ その4(設定値を保存・読み込みしてみる)

Posted at

今回は、設定値を保存して、保存した設定値を読み込みしてみます。

設定値を保存する仕組み

設定値を保存する仕組みが用意されています。

こちらを使って保存と読み込みをすることができるようです。

# 設定値を保存する
まずは資料の通りに設定してみます。

config.js
(function (pluginId) {
    "use strict";
    window.addEventListener('DOMContentLoaded', function() {
        document.getElementById("button_submit").onclick = function() {
            var config = {
                "key1": "value1",
                "key2": "value2"
            };
            kintone.plugin.app.setConfig(config);
        };
    });

})(kintone.$PLUGIN_ID);

保存した設定値を表示する

上記で保存した設定を表示してみます

config.js
(function (pluginId) {
    "use strict";
    window.addEventListener('DOMContentLoaded', function() {
        console.log(kintone.plugin.app.getConfig(pluginId));
        document.getElementById("button_submit").onclick = function() {
            let config = {
                "key1": "value1",
                "key2": "value2"
            };
            kintone.plugin.app.setConfig(config);
        };
    });

})(kintone.$PLUGIN_ID);

ログを確認します。
スクリーンショット 2019-01-23 7.41.31.png

設定した値を読み込みできました。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0