Create record but table no data.

Test create data to table

kintone.events.on(‘app.record.index.show’, function(event){
let appId = event.appId;

var Data = new Array();

var Create = { ‘containerNo’: {
‘value’: ‘approve’
},
‘Table’: {
‘type’: ‘SUBTABLE’,
‘value’: [
{
‘t_No’: {
‘type’: ‘SINGLE_LINE_TEXT’,
‘value’: ‘abc’
},
‘t_ProductCode’: {
‘type’: ‘SINGLE_LINE_TEXT’,
‘value’: ‘ABF’
}
}

]
}
}

Data.push(Create)

var Body = {
“app”: AppId_,
“records”: Data
}

console.log('Body : ’ + JSON.stringify(Body));

kintone.api(kintone.api.url(’/k/v1/records’, true), ‘POST’, Body, function(resp) {
// success
console.log('success : ’ + JSON.stringify(resp));
// console.log(‘success’);
}, function(error) {
// error
console.log(error);
});

});

NewTum Channel, thanks for your question.

Could you elaborate on the question, as it is vague.
It’s very hard for community members to debug your code when there is very limited context.

I understand you are trying to place data into a table, but here are some information you can share with us:

  • On what page or event do you want the data to be created on?
  • What result are you currently getting? If you are getting errors, please share.

Dear William Sayama

I want to create a record with data in table form.

I can create a record, But no data in the table.

 ![](https://developer.kintone.io/hc/user_images/JivowaRU3kXMv6KqIBO7hA.png)

Do you have an example to create a record and have tables?

Rest API for javascript in kintone.

Hello NewTum

The following is an example of inputting table data upon creating a record:

(function() {
'use strict';

kintone.events.on('app.record.create.show', function(event) {
// Create Rows
var newRow1 = createValue_('1', 'Hello this is Chris');
var newRow2 = createValue_('2', 'Good bye, Tom');

// Input Default Value in the Table
event.record.Table.value = [
newRow1,
newRow2
];
return event;
});

function createValue_(number, text) {
return {
'value': {
'Number': {
'type': 'NUMBER',
'value': number
},
'Message': {
'type': 'SINGLE_LINE_TEXT',
'value': text
}
}
};
}
})();

Kintone Developer Program - Retrieve and manipulate table data
https://developer.kintone.io/hc/en-us/articles/115003081768-Retrieve-and-manipulate-table-data