Help

Re: Scripting Block

1119 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Anika_Hussen
5 - Automation Enthusiast
5 - Automation Enthusiast

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:

8 Replies 8

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!

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.

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.

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 -

image

image

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…).

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);

thank you! I highly appreciate it.