Help

Save the date! Join us on October 16 for our Product Ops launch event. Register here.

Copying records to another table with dissimilar columns

Topic Labels: Scripting extentions
1613 1
cancel
Showing results for 
Search instead for 
Did you mean: 
Felix_Fabich
6 - Interface Innovator
6 - Interface Innovator

Hi there :slightly_smiling_face:

I want to copy certain fields of a record to another table.

Example:
table 1 has 3 fields with names: 1,2,3
table 2 has 4 fields with names: 1,3,4,5

When the script is run, all records of table 1 should be copied to table 2 into fields 1 and 3 (leaving fields 4 and 5 empty). Could you give me some direction as to what should go into the bold section?

What I have so far:

let table1 = base.getTable(‘Table 1’);
let table2 = base.getTable(‘Table 2’);
let copyQuery = await table1.selectRecordsAsync();
for (let record of copyQuery.records){
table2.createRecordsAsync([
{
//what should be here
}
]);
};

1 Reply 1

Follow this thread: