何を実現したいのかを書きましょう
kintone.events.on(‘app.record.index.show’, handler);
というイベントハンドラーを使ってレコードを取得しようとしています
ハンドラーの部分を下記のように記述しました
let handler = function(event) {
var record = event.record;
console.log(“Handler function is executed.”);
console.log(“Record object:”, record);
// Aアプリのフィールド値を取得
var dateA = record[“日付”].value;
var factory = record[“所属工場”].value;
var category = record[“弁当区分2”].value;
var employeeName = record[“社員名”].value;
var recordId = event[“recordId”];
発生した問題やエラーメッセージを具体的に書きましょう
このようにエラーが出ています。
You
a02ee6:36 Handler function is executed. download.do?app=419&contentId=34019&jsType=DESKTOP&hash=3ca082960fb755a5576a8009b0c648e226a02ee6:37 Record object: undefined index.js:124 Uncaught TypeError: Cannot read properties of undefined (reading ‘日付’) at handler (download.do?app=419&contentId=34019&jsType=DESKTOP&hash=3ca082960fb755a5576a8009b0c648e226a02ee6:41:23) at index.js:247:115 at new ik (index.js:125:216) at tw (index.js:247:94) at index.js:246:425 at e.G (index.js:127:105) at zk (index.js:129:123) at uk (index.js:129:6) at ik.F (index.js:850:102) at bk (index.js:125:63)
ログを確認すると
Handler function is executed.となっているのでイベントハンドラーに問題はないことは確認できました
Record object: undefinedとなっており
var dateA = record[“日付”].value;
の部分がうまく取得できていないことはわかったのですが
フィールドコードを調べてもフィールドコード名が「日付」とあっているにもかかわらず取得できないのは、コードの記述に問題があるのかな?と思っています
取得しようとしているフィールド形式は日付形式なのですが、日付形式のものを取得するときの記述方法はこれであっているのでしょうか?
どなたかわかる方教えていただきたいと思います
実行したコードをコピー&ペーストしましょう
コードをここに入力または貼り付け