お世話になっております。
下記実現したいことをする上で困っているので何かわかる方おられたら力を貸していただけると助かります。
【実現したいこと】
・編集画面にてメモ項目のみを更新するボタンを押下して、ポップアップを表示させずに詳細画面へリダイレクトとしたい(データはメモを更新した状態のレコードを表示したい)
【現状】
画像にある更新ボタンを押下時にメモが更新された詳細ページに飛ばすことができている。
ただ、その移動する前に二つのポップアップが表示されてしまい内容が内容なので消したい。
【実行したコード】
(() => {
'use strict';
kintone.events.on('app.record.edit.show', (event) => {
const memoSpace = document.getElementById('user-js-memos_button');
const updateButton = document.createElement('button');
updateButton.innerText = "更新";
updateButton.classList.add("update-button")
updateButton.addEventListener('click',async () => {
const dataUrl = kintone.api.url('/k/v1/record.json', true) + '?app=' + kintone.app.getId() + '&id=' + kintone.app.record.getId();
const memoTextBox = document.getElementsByClassName('textarea-cybozu')[0];
const memoValue = memoTextBox.value
const requestParam = {
"app":kintone.app.getId(),
"id": kintone.app.record.getId(),
"record": {
"memo": {
"value":memoValue
}
}
}
Object.defineProperty(window, 'onbeforeunload', {
set(newValue) {
if (typeof newValue === 'function') window.onbeforeunload = null;
}
});
kintone.api(kintone.api.url('/k/v1/record.json',true),'PUT',requestParam)
console.log(location.origin + location.pathname + '#record=' + kintone.app.record.getId());
location.replace(location.origin + location.pathname + '#record=' + kintone.app.record.getId());
location.reload();
})
memoSpace.replaceWith(updateButton);
})
})();