Jun 06, 2020 05:20 AM
When I add a new row in X table and click te button a script would copy all rows from /table into table. Is it possible with using script? I developed a script like below but it doesn’t work.
Jun 06, 2020 11:02 AM
How can I get the processed row’s value?
I mean if I click on the last link in the table “X” I want to get “New Y” text and use it in the script.
Jun 06, 2020 02:33 PM
There’s a lot of info missing from your question, but I get the impression you’re using the new button field beta. Is that correct? Are you asking how to get the value for the record where you clicked the button?
Jun 06, 2020 02:39 PM
Yes. you are right. Getting record of clicked on the button.
Jun 06, 2020 03:01 PM
You first need to get the table where the record lives:
let table = base.getTable("TABLE NAME");
If the record is part of a specific view, you could use that instead of the table, but you still need to get the table first:
let table = base.getTable("TABLE NAME");
let view = table.getView("VIEW NAME");
Once you have the table/view, you can get the record (use only one of the following):
let record = await input.recordAsync("Pick a record", table);
OR
let record = await input.recordAsync("Pick a record", view);
The “Pick a record” text is irrelevant, as Airtable will know to grab the record where you clicked the button.
With that, you can get the name of the record (i.e. the contents of its primary field) using record.name
, or any other field value using record.getCellValue("FIELD NAME")