イベント レコードのカスタム ボタンからメモ エディターを開こうとしています。この現在のソリューションに基づいて、ボタンを押すと呼び出される新しい Aura コンポーネントを作成しました。オーラはまず DB にメモ レコードを挿入し、メモの ID をヘルパーに返します。次に、SF が提供する open note イベントを呼び出すために、その Id を使用することになっています。私のヘルパーは次のようになります。
({
createNewNote : function(cmp){
var that = this;
var action = cmp.get("c.insertNewNote");
action.setParams({"parentId": cmp.get("v.recordId")});
action.setCallback(this, function(response) {
var state = response.getState();
if (state === "SUCCESS") {
cmp.set("v.newNoteId", response.getReturnValue());
console.log(cmp.get('v.newNoteId'));
that.editNote(cmp, response.getReturnValue());
}
else {
console.log("Failed with state: " + state);
}
});
$A.enqueueAction(action);
},
editNote : function(cmp, noteId) {
console.log('in evt', noteId);
var editEvent = $A.get("e.notes:editNote")
console.log(editEvent);//this is undefined
editEvent.setParams({
"noteId": noteId
});
editEvent.fire();
}
})
問題は、この行$A.get("e.notes:editNote")が定義されておらず、パラメーターを設定しようとするとエラーが発生することです。
window.$A.get("e.notes:editNote") のようなアクションを呼び出してみましたが、成功しませんでした。また、イベントが存在することを確認しました。window.$A.get("e"); を呼び出すと、クロムコンソールでは、次のように見つけることができます
コンソールでイベントを取得するさまざまな方法も試しましたが、未定義しか取得できません。このイベントを呼び出す方法はありますか?