
Update table ⇒ Update corresponding record of another application
Hello Dev teams, can i ask this one!
When I press the save button, the data is transferred to another app at the edit event.
so, i want to ask
The error appears as follows in the line id (187), please tell me why the error, thank you very much.
13 comments
Can you tell me what kind of error are you seeing?
Hi Yuzo Arai,
When I press the save button for the first time this error occurs.
Thank you so much.
Hi NDC,
Hi Sean Tachibana,
Have a nice day.
As I answered Mr Yuzo Arai, the data after pressing the save button is still correctly returned when I debug (console) ,. but the returrn line is undefined,
How do I try, and how else to debug?
Would you please do a demo app like me, 1 property for the header and 1 table of 2 properties. just 1 or 2 properties help me to unpack the edit function.
Hi Sean Tachibana,
Hi Yuzo Arai,
I'm sorry for bothering you both. I will stop here ..
Hello NDC,
When I debugged the script by doing the following:
it gave me an "undefined" error in the third row.
console.log(row.value.id);
This means that the id does not exist. And this is why you are experiencing the error.
I experimented with the script myself,
and when I put a fixed value like the following,
I didn't see any error:
Try to fix your script in a way that specifies a record
that you want to update.
If you need help on debugging,
please use the following page as your help:
Kintone Developer Program - Debugging tips for Kintone JS
https://developer.kintone.io/hc/en-us/articles/115003211768-Debugging-tips-for-Kintone-JS
For you reference, I will leave the script that I used when I was testing below:
Hello Yuzo Arai,
I already know my error is because the two apps don't have the same id, it is always skewed at birth, because on App A side if there are 2,3,4 rows in table Whereas side id has only 1, then on the B side it will generate 2,3,4 id records, so always deviate, will not be able to correct. It can only be edited when there is 1 row in a table.
as shown below:
Would you please give me any suggestion to solve this place?
Hi Sean Tachibana,
I have fixed the above error, thanks for your advice.
Would you mind if I could ask more?
**** How do i return the 2nd table?

Thank you for your help.
Hello NDC,
I'm not quite understanding what you mean by 2nd table.
Can you post the screenshots of your app that clarifies more about what you're trying to do?
Thank you
Hi Yuzo Arai,
I have chosen another way.
Would you mind if I could ask more?
I want to show the error as the figure I provide when i handle checking :
With my code as below, How do I handle it like the figure I provide?
(function () {
"use strict";
// 更新時の処理
kintone.events.on("app.record.edit.submit", function (event) {
var record = event.record;
var subTable = record['yaoya_subtable'].value;
//var required_id = record['id'],
var msgErr_ary = [];
var last_element = subTable[subTable.length - 1];
var first_element = subTable[0];
var elStatus = kintone.app.getFieldElements('id');
var fontColorRed = "#ff0000";
for (var i = 0; i < subTable.length; i++) {
if (subTable[i].value.id.value != 0) {
subTable[i].value.id.disabled = true;
}
else
if (subTable[i].value.id.value == 0) {
subTable[i].value.id.disabled = false;
}
}
if (first_element.value.id.value != 0) {
for (var i = 0; i < subTable.length; i++) {
if (subTable[i].value.id.value == 0) {
subTable[i].value.id.style.background = fontColorRed;
msgErr_ary.push(subTable[i].value.itemA.value);
}
}
}
if (first_element.value.id.value != 0) {
if (last_element.value.id.value != 0) {
console.log("Check ok bro!");
}
}
var msg_str = msgErr_ary.join(' and ');
event.error = msg_str;
return event;
});
})();
Hi NDC,
I found an article that might fit the description.
Please take a look and see if it accomplishes the desired process.
This sample runs validation checks for values inside tables when saving the record.
Validation checks in tables:
https://developer.kintone.io/hc/en-us/articles/115005616728-Validation-checks-in-tables
Hopefully, this helps.
Hi Sean Tachibana/ Hello Yuzo Arai/
i Did it, tks you/. have a nice day.