Mar 10, 2020 10:27 AM
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:
Mar 10, 2020 10:35 AM
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!
Mar 10, 2020 10:59 AM
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.
Mar 10, 2020 11:01 AM
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.
Mar 10, 2020 01:04 PM
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…).
Mar 11, 2020 01:28 PM
Yes, that is what I would like to do!
Mar 11, 2020 08:03 PM
Understood - I’ll share a code snippet with you first thing tomorrow.
Mar 12, 2020 04:24 AM
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);
Mar 12, 2020 08:47 AM
thank you! I highly appreciate it.