Below is the code am using to link up data between two tables. This was working fine until I did the same on another base and it threw this error. Any help is appreciated!
error: TypeError: Cannot read property ‘table2_id’ of undefined
at e.value
at eval , line: 24
at Array.forEach
at Proxy.main , line: 17
const mainTable = 'Interactions';
const mainView = 'Default View';
const mainLinkCol = 'Buyer Master';
const secTable = 'Buyer Master';
const secView = 'Default View';
const secLinkCol = 'Interactions';
const mainLinkId = base.getColumnLinkId(mainTable, mainLinkCol);
output.text(mainLinkId);
const rows = base.getRows(mainTable, mainView);
rows.slice(0, 1).forEach(row => {
if (row.Mobile && row.Name) {
const querySet = base.filter(secTable, secView, `Mobile = ${row.Mobile} and Name = "${row.Name}"`);
const linkedRow = querySet.first();
if (linkedRow) {
const linkedRowId = linkedRow._id;
if (row[mainLinkCol].length === 0) {
base.addLink(mainLinkId, mainTable, secTable, row._id, linkedRowId);
}
}
}
});