Ive looked at numerous other community posts but don’t seem to be understanding this. I want to update a linked field with a room location. The location is being provided by users selecting it from a list via recordasync, and I’m storing it as a string with .name.
This unlinked field updates without issue:
sourceTable.updateRecordAsync(recordID,{'nonlinked location': roomName});
but i can’t get the linked table to update no matter how I format the portion after the :. I’ve tried
sourceTable.updateRecordAsync(recordID,{'linked location': a{id: roomName}]})
and other variations of that to no avail. I believe it has to do with the location being passed as a string to the linked array, but I’m not sure how to format either the input or the updaterecord to accept the change.
The script is meant to accept a room choice, then the user enters an Item Number and the script updates the location of that item with the room chosen in step 1.
let location = base.getTable("Rooms");
let sourceTable = base.getTable("Inventory");
let sourceTableName = sourceTable.name;
let sourceField = sourceTable.getField('ItemNumber');
let sourceFieldName = sourceField.name;
let locationField = sourceTable.getField("Location");
let locationFieldName = locationField.name;
// Prompt the user to pick a Room
let currentroom = await input.recordAsync('Select a Room to Scan', location);
let roomName = currentroom.name;
// get the assett tag
output.markdown("### Enter the Asset tag:");
let thisQueryValue = await input.textAsync('What is the asset tag?');
// get the records
let result = await sourceTable.selectRecordsAsync();
let sourceRecords = result.records;
let recordID;
// iterate across all the records
for (var r = 0; r < sourceRecords.length; r++)
{
if(thisQueryValue == sourceRecordsrr].getCellValue(sourceFieldName))
{
let currentRecord = sourceRecordsrr];
let recordID = sourceRecordsrr].id;
sourceTable.updateRecordAsync(recordID,{'nonlinked Location: roomName});
sourceTable.updateRecordAsync(recordID,{'Location': roomName});
}
}