Presetting Tables

Hi,

Does anyone know of a way to preset elements of a table? For example, if you preset elements of a table, then every time someone creates a new record in that app, a table will appear with the first column filled out with, for this example, tasks and the rest of the columns would only have the header (field) preset.

Sort of like the image below, where the tasks would automatically appear when you create a new record, but the ‘done?’, ‘priority’, and ‘due date’ columns are blank:

http://www.exceltemple.com/wp-content/uploads/2015/06/Daily-Task-List-Excel-Template.png

Hi Brian

in create.show event , you can preset elements of a table.

kintone.events.on('app.record.create.show', function(event) {

var record = event.record;

    if(event.record['Table']['value'].length > 0){
        var r1 = event.record['Table']['value'].length - 1;
        event.record['Table']['value'].splice(r1,1);
    }

    
     //Subtable insert new row
    for(var i=0;i<3;i++){
        var newRow = {
            value: {
                text01: {
                    type: 'SINGLE_LINE_TEXT',
                    value: 'new line text '+ i
                }
            }
        };

        record['Table']['value'].push(newRow);

    }
    
    return event;
});

 

Hi Minoru, great, thank you! I will try this out :slight_smile: