Scripting Block

Hello!

Just a general question about the Scripting block. When filtering records and displaying values, is there a way to click into the record itself. For example, if I am listing out all projects due in March, could I potentially click on a listed record that would expand the record. (perhaps, converting the record values to a datatype that is not string, but rather “record”)

Thank you :blush:

No, that’s not available in the Scripting block. The Scripting block is really only capable of outputting text and file thumbnails right now – although it is capable of producing interactive buttons, so it seems feasible that this is something they could make available in the future!

1 Like

For the specific use case you describe, Airtable’s native filters and saved views work very well.

If Airtable’s native filters do not provide the functionality you want, you could create a new checkbox field that a script sets or clears. Then, create a new view that filters based on that new field.

2 Likes

And to add to @kuovonne’s suggestion, after setting up what she describes, you could also use the “Record List” block to display records from a particular view in a table inside the block, while still being able to navigate to other tables.

1 Like

Yes, but to confirm, you want to list records in a Script Block and then access any of the records (in the record edit view) with a single click, right? If this is the requirement, I do it all the time -

One of the current drawbacks to this approach is that the markdown method in Script Blocks sanitizes all HTML (and DOM access) making it impossible to provide a clean UI that simply displays the record in context with the current browser tab. Markdown links can only open a new tab (boo…).

1 Like

Yes, that is what I would like to do!

Understood - I’ll share a code snippet with you first thing tomorrow.

Okay - here’s a brief example that creates a list of records from a selected table where each item is linked to the record itself.

output.markdown('# Record Linking Example');

// select the table
let currentTable = await input.tableAsync('Select a table');
let queryResults = await currentTable.selectRecordsAsync();
let oRecords = queryResults.records;

// build the list
var recordList = "";
for (let record of oRecords)
{
  recordList += "- [" + record.name + "](" + currentTable.url + "/" + record.id + ")\n";
}

// render the list
output.markdown(recordList);
2 Likes

thank you! I highly appreciate it.

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.