Hi there,
I'm not a developer but I'm exploring and using various scripting options, but can't seem to mitigate the crash I encounter when to use the script below. Can someone help with this? Thanks in advance!
The feature I want to build is a bigger one: it's a vlookup feature with auto categorization based on the intermediate table [personal categorization] - so a script to conditionally link a record.
But this is a simplified version without that auto vlookup to focus first on the crash when trying to link a record:
Here I choose one record from table [personal expenses] and one from the table [personal categorization].
The field [Type] in table [personal categorization] is a linked field with a link to a record in a 3rd table [personal budget].
What I want to do in the end, is that the chosen record in [personal expenses] is linked to the record in [personal budget] via the field [tmpLookUpLinks], and that value should be retrieved from the field [Type] in the [personal categorization] table.
Note: each link has only 1 link, no multiple record link fields are configured
The script crashes when running. FYI: maybe there's a connection with this forum post, but not quite sure.
See below for the simplified code; hopefully someone can help!
// Get the record
let mainTable = base.getTable("personal expenses")
let recordMainTable = await input.recordAsync('Select a record', mainTable)
let lookupTable = base.getTable("personal categorization")
let recordLookupTable = await input.recordAsync('Select a record', lookupTable)
let linkTypeID = recordLookupTable.getCellValue("Type")[0].id;
let tmpLookUpLinks = "tmpLookUpLinks";
await mainTable.updateRecordAsync(recordMainTable, {
"tmpLookUpLinks": [{id: linkTypeID.id}],
})