Skip to content

Links

Link columns connect rows between tables. Most link operations require the link_id, which you can retrieve with getColumnLinkId.

getColumnLinkId

Get the link ID of a link column. You need this ID for all other link operations.

base.getColumnLinkId(tableName, columnName);

Output Link ID string (e.g. 'aHL2')

Example

const linkId = base.getColumnLinkId('Table1', 'Related Records');

Get Linked Records

getLinkedRecords

Get the linked records of one or more rows. Supports pagination per row.

await base.getLinkedRecords(tableId, linkColumnKey, rows);

Output Object with row IDs as keys and arrays of linked record info as values.

Example

const linked = await base.getLinkedRecords('0000', '89o4', [
    {'row_id': 'FzNqJxVUT8KrRjewBkPp8Q', 'limit': 10, 'offset': 0},
    {'row_id': 'Jmnrkn6TQdyRg1KmOM4zZg', 'limit': 20}
]);

// Result:
// {
//   'FzNqJxVUT8KrRjewBkPp8Q': [
//       {'row_id': 'LocPgVvsRm6bmnzjFDP9bA', 'display_value': '1'},
//       ...
//   ],
//   'Jmnrkn6TQdyRg1KmOM4zZg': [...]
// }

addLink

Create a link between two rows in different tables.

base.addLink(linkId, tableName, otherTableName, rowId, otherRowId);

Example

base.addLink('5WeC', 'Projects', 'Contacts', 'CGtoJB1oQM60RiKT-c5J-g', 'PALm2wPKTCy-jdJNv_UWaQ');

updateLink

Replace all linked records of a row with a new set.

base.updateLink(linkId, tableName, otherTableName, rowId, otherRowIds);

Example

base.updateLink('r4IJ', 'Table1', 'Table2', 'BXhEm9ucTNu3FjupIk7Xug', [
    'exkb56fAT66j8R0w6wD9Qg',
    'DjHjwmlRRB6WgU9uPnrWeA'
]);

batchUpdateLinks

Update links for multiple rows at once.

base.batchUpdateLinks(linkId, tableName, otherTableName, rowIdList, otherRowsIdsMap);

Example

await base.batchUpdateLinks('WaW5', 'Table1', 'Table2',
    ['fRLglslWQYSGmkU7o6KyHw', 'eSQe9OpPQxih8A9zPXdMVA'],
    {
        'fRLglslWQYSGmkU7o6KyHw': ['MdfUQiWcTL--uMlrGtqqgw', 'E7Sh3FboSPmfBlDsrj_Fhg'],
        'eSQe9OpPQxih8A9zPXdMVA': ['cWHbzQiTR8uHHzH_gVSKIg', 'X56gE7BrRF-i61YlE4oTcw']
    }
);

removeLink

Remove a link between two rows.

base.removeLink(linkId, tableName, otherTableName, rowId, otherRowId);

Example

base.removeLink('5WeC', 'Projects', 'Contacts', 'CGtoJB1oQM60RiKT-c5J-g', 'PALm2wPKTCy-jdJNv_UWaQ');