Last active
August 29, 2015 14:04
-
-
Save icoxfog417/1ed960df500118409294 to your computer and use it in GitHub Desktop.
kintone JavaScript Customize template
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* kintone javaScriptカスタマイズのテンプレート | |
* | |
* Licensed under the MIT License | |
*/ | |
(function() { | |
"use strict"; | |
//リスト一覧表示時(pc) | |
kintone.events.on("app.record.index.show", function(event){ | |
//アプリIDの取得 | |
var appId = kintone.app.getId(); | |
//ユーザー情報の取得 | |
var user = kintone.getLoginUser(); | |
alert("Hellow " + user.name + ". now show records! appId is " + appId); | |
}); | |
//レコード表示時(pc) | |
kintone.events.on("app.record.detail.show", function(event){ | |
var recordId = kintone.app.record.getId(); | |
alert("now show record " + recordId + "!"); | |
}); | |
//レコード編集時(pc) | |
kintone.events.on("app.record.edit.show", function(event){ | |
/* | |
//レコードの値の取得とセット | |
var record = kintone.app.record.get(); | |
record["record"]["フィールド名"]["value"] = "書き換えた値"; | |
kintone.app.record.set(record); | |
*/ | |
alert("now edit record!"); | |
}); | |
//レコード編集保存前(pc) | |
kintone.events.on("app.record.edit.submit", function(event){ | |
alert("now save edit!"); | |
}); | |
//レコード追加時(pc) | |
kintone.events.on("app.record.create.show", function(event){ | |
alert("now record create!"); | |
}); | |
//レコード追加保存前(pc only) | |
kintone.events.on("app.record.create.submit", function(event){ | |
alert("now save create!"); | |
}); | |
//レコード削除前イベント(pc) | |
kintone.events.on("app.record.detail.delete.submit", function(event){ | |
alert("now delete record!"); | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
kineont APIドキュメント
レコード一覧表示イベントの際使える処理
列単位でなく、行を取得したい場合は
event.records
で取得する。行を取得しての処理はこちらが参考になります。レコード詳細情報取得
kintone REST API リクエスト
他のアプリ、また自分のアプリのデータをJavaScriptから取得したい場合は、REST APIを利用します。
※ゲストユーザーは使えないので注意してください(2014/7現在)。
自分のアプリ内のレコード(レコード番号=5)の取得
PCとスマートフォンで使える関数の対応表