3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

kintoneのsetConfig()でUncaught Error: Usage:というエラーの解決方法

Last updated at Posted at 2017-06-10

プラグイン設定画面にて、kintone.app.setConfig()関数を使う時に下記のようなエラーが出ることがあります。

スクリーンショット 2017-06-10 13.47.51.png

エラーメッセージ:Uncaught Error: Usage:
kintone.plugin.app.setConfig(config, opt_callback)


上の写真の例のように配列などを含んでいる場合は、JSON.stringifyで配列オブジェクトを JSON テキストに変換すればOKです。
つまり、下記コードにすればうまくいきます。

config.key = JSON.stringify(["a","b","c"]);


そしてconfigのデータを使う時はJSON.parseで元に戻してから使ってください。

(例)
var config = kintone.plugin.app.getConfig("プラグインID");
var key = JSON.parse(config['key']); // ["a","b","c"]

3
2
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
3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?