Skip to main content
Solved

Selecting a record after pressing button

  • January 29, 2021
  • 1 reply
  • 26 views

Hello all,

I’m a no-code programmer (if that’s even possible) so for everything I do I look for a similar example and I copy and adapt.

I’m trying to make a script where after pressing a button the user is asked for a couple of values to be updated in that record. I’m not able to find any script example where it automatically selects the record which button was pressed, and I always see something like this:

const record = await input.recordAsync(“Pick a record”, table);

Where user has to find and choose again the record to be updated.

How can I do that? Is it possible?

Thank you!!!

Angel

Best answer by JonathanBowen

Hi @Angel_Baena - there’s two places you can run a script from - the script panel in the scripting app and via a script button on the record:

If the script has a record input line, e.g.:

let record = await input.recordAsync('Please select a order', orders);

then if you run the script from the scripting app, you will be prompted to find and select a record.

However, if you run the script by clicking on the script button for a specific record, the chosen record will be passed through to the script without any further find/select. You don’t need to change the script in any way to allow this - just something built into Airtable when using await input.record

1 reply

JonathanBowen
Forum|alt.badge.img+18
  • Inspiring
  • 1110 replies
  • Answer
  • January 30, 2021

Hi @Angel_Baena - there’s two places you can run a script from - the script panel in the scripting app and via a script button on the record:

If the script has a record input line, e.g.:

let record = await input.recordAsync('Please select a order', orders);

then if you run the script from the scripting app, you will be prompted to find and select a record.

However, if you run the script by clicking on the script button for a specific record, the chosen record will be passed through to the script without any further find/select. You don’t need to change the script in any way to allow this - just something built into Airtable when using await input.record