https://cybozudev.zendesk.com/hc/ja/articles/200752984-%E3%83%AC%E3%82%B3%E3%83%BC%E3%83%89%E6%9B%B4%E6%96%B0%E3%81%AB%E3%81%8A%E3%81%91%E3%82%8B%E3%83%86%E3%83%BC%E3%83%96%E3%83%AB%E6%93%8D%E4%BD%9C%E3%81%AE%E3%83%86%E3%82%AF%E3%83%8B%E3%83%83%E3%82%AF
にて
行追加であっても、すでにテーブルにあった値をリクエストに含める必要があります。
とあったのでテーブルをコピー、その後ろに追加しようと思っているのですができません
どうすればいいでしょうか?
(function () {
"use strict";
kintone.events.on('app.record.create.show', function (event) {
// kintone.api('/k/v1/record', 'GET', {app: 116, id:828}, function(resp) {
// var record = event.record;
//var a = resp.record['Table']['value'].length
//var c = resp.record['Table']['value']
// for(var i=0;i<a;i++){
//console.log(c[i]['id']);
// }
//});
});
kintone.api('/k/v1/record', 'GET', {app: 116, id:828}, function(resp) {
var record = event.record;
var a = resp.record['Table']['value'].length
var c = resp.record['Table']['value']
// for(var i=0;i<a;i++){
console.log(c[0]['id']);
// }
kintone.events.on('app.record.create.submit', function (event) {
var record = event.record;
var g = record['現況'].value;
var d = record['日付'].value;
var z = record['コメント'].value;
var x = record['土地'].value;
var v = record['地目'].value;
var b = record['筆区分'].value;
var n = record['地積'].value;
var m = record['緯度'].value;
var l = record['経度'].value;
// kintone.api('/k/v1/record', 'GET', {app: 116, id:828}, function(respq) {
//var c = respq.record['Table']['value']
//var a = respq.record['Table']['value'].length
//console.log(c);
var s =a+1;
console.log(c[s]);
var parma = {
"app": 116,
"id": 828,
"record": {
"Table": {
"value": {
}
}
}
};
for(var i=0;i<a;i++){
parma.record['Table'].value[c[i]['id']]=
{
"value": {
"オリジナル": {
"value": c[i]['id']
},
"現況a": {
"value": g
},
"コメント":{
"value": c[i]['value']['コメント']['value']
},
"土地住所":{
"value": c[i]['value']['土地住所']['value']
},
"地目":{
"value": c[i]['value']['地目']['value']
},
"筆区分":{
"value": c[i]['value']['筆区分']['value']
},
"地積":{
"value": c[i]['value']['地積']['value']
},
"調査日":{
"value": c[i]['value']['調査日']['value']
},
"緯度":{
"value": c[i]['value']['緯度']['value']
},
"経度":{
"value": c[i]['value']['経度']['value']
}
}
};
var parma = {
"app": 116,
"id": 828,
"record": {
"Table": {
"value": [
{
"id": c['3']['id']+1,
"value": {
"オリジナル": {
"value": c[i]['id']
},
"現況a": {
"value": g
},
"コメント":{
"value": z
},
"土地住所":{
"value": x
},
"地目":{
"value": v
},
"筆区分":{
"value": b
},
"地積":{
"value": n
},
"調査日":{
"value": d
},
"緯度":{
"value": m
},
"経度":{
"value": l
}
}
}
]
}
}
}
if(Object.keys(parma.record["Table"].value).length === c.length)
kintone.api(kintone.api.url('/k/v1/record'), 'PUT', parma);
}
})
})
})();
こんなプログラムを使っています