Aug 31, 2020 07:17 AM
Hi everyone,
Is there any way on a script to link to a record directly from the script window with the output object ?
My usecase is the following : We use a script to detect all missing information in a table and show records where some are missing. We use output.table for that and it works great, but it lacks a way to be able to expand the corresponding records to directly modify it without being forced to do a search on the view panel to find the same records.
Thanks for the help :winking_face:
Oct 13, 2020 07:06 AM
Yes. The clue here is output.markdown() which supports tables and text with embedded links.
Oct 13, 2020 08:31 AM
Thanks Bill for the answer. I already use output.table and output.markdown() but don’t find any way to have a link to an expand view of the record with that ? you know what i mean ? :slightly_smiling_face:
Oct 13, 2020 04:20 PM
I believe I do and it works great for me -
Oct 13, 2020 11:11 PM
Oh ok, i understand the difference. Sorry for not being clear.
What i want is the Record Id here to be expandable. You’re right that a “link to another record” field works, but i don’t see how i can have the whole records itself expandable.
In your example, i want to be able to click on the record id for example.
Thanks again for your time
Oct 14, 2020 03:55 AM
Okay, and then what happens exactly?
Oct 15, 2020 01:04 AM
It open the same popup when you expand a record on a view list or when you click on a “linked field” records
Oct 15, 2020 06:15 AM
Like this?
In case this is what you were hoping for - here’s the script block:
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 = "| Record ID | Name |\n";
recordList += "| ----------- | ----------- |\n";
for (let record of oRecords)
{
thisName = "";
recordList += "|[" + record.id + "](" + currentTable.url + "/" + record.id + ")|" + record.name + "|\n";
}
// render the list
output.markdown(recordList);
Oct 16, 2020 08:06 AM
A little bit different than what i expected (because it open a new browser tab instead of staying in the same tab and instance of airtable), but it will do the job i think.
I was expecting a native way for airtable to have a link to the expand card, but forging the whole url seems to work.
Thanks again for your help on that. :winking_face:
Oct 16, 2020 08:54 AM
This is possible as well but with — and only with — a custom block (i.e., a React app).