Hello,
I have a problem with the “app.record.create.submit” event.
Please have a look here.
kintone.events.on('app.record.create.submit', function(event) {
var url = "https:/./.....";
loadData(url);
});
kintone.events.on('app.record.create.submit.success', async function(event) {
console.log("This is submit.success event");
});
function loadData(url) {
return new kintone.Promise(function(resolve, reject) {
console.log("AAAAAAAAAAAAAAAAAAA");
var xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
xhr.setRequestHeader('X-Cybozu-API-Token','INSERT_API_TOKEN');
xhr.responseType = 'blob';
xhr.onload = function() {
console.log("CDDCDCDCDCDCDCDCDC");
if (xhr.status === 200) {
console.log("BBBBBBBBBBBBBBBBBBBBB");
resolve(xhr.response);
}
else { console.log(xhr.responseText);}
};
xhr.onerror = function () {
reject(Error('error fetching data'));
};
console.log("CCCCCCCCCCCCCCCCCCC");
xhr.send();
console.log('DDDDDDDDDDDDDDDDDDD');
}).then(function(resp) {
var blob = new Blob([resp]);
console.log("HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH");
uploadDocxAndAddtoField(blob);
},function(error) {
console.log(error);
});
}
Expected Result:
AAAAAAAAAAAAAAAAA
CCCCCCCCCCCCCCCCCC
CDCDCDCDCDCDCDCD
BBBBBBBBBBBBBBBBBBB
HHHHHHHHHHHHHHH
Actual Result:
AAAAAAAAAAAAAAAAA
CCCCCCCCCCCCCCCCCC
DDDDDDDDDDDDDDD
This is submit.success event <- {this is "app.record.create.submit.success" event}
BBBBBBBBBBBBBBBBBB
{Then, it is redirected to record.show}
Please Help me.