Skip to main content
Question

Automation scripting error -- issue with collecting input variable

  • November 12, 2025
  • 5 replies
  • 28 views

Forum|alt.badge.img+5

I’m working on a script in an automation (triggered when new record enters a view) where I need to collect some variables (from the record that triggered the automation) to include in an outbound web hook. I’m getting an error on the record.getCellValueAsString lines:

TypeError: Cannot read properties of undefined (reading 'getCellValueAsString')

let inputConfig = input.config();
let recordId = inputConfig.recordId;
const table = base.getTable("table_name");
let record = table.recordId;
let var1 = record.getCellValueAsString("field_name");
let var2 = record.getCellValueAsString("field_name");

5 replies

Mike_AutomaticN
Forum|alt.badge.img+28

Hey ​@Brett-Stineman,

I’m not a coder myself. So I just went ahead and asked chatgpt.
I’ll play around with it as soon as possible, but you might want to take a look at the asnwer below (which I did not test on my side yet).


The issue is in this line:
let record = table.recordId;

 

That doesn’t actually fetch a record — it’s just accessing a property that doesn’t exist.

To fix this, you need to use selectRecordAsync() to retrieve the record object before calling .getCellValueAsString().

 

Here’s the corrected version of your script 👇

let inputConfig = input.config();
let recordId = inputConfig.recordId;

// ✅ Get the table reference
const table = base.getTable("table_name");

// ✅ Fetch the actual record using the recordId
let record = await table.selectRecordAsync(recordId);

// ✅ Now you can safely access field values
let var1 = record.getCellValueAsString("field_name_1");
let var2 = record.getCellValueAsString("field_name_2");

// Example: send webhook or log values
console.log(var1, var2);


Please let me know if by any chance this helped! 

Completely different matter, but would love to have you join our Airtable Hackathon! Make sure to sign up!!

Mike, Consultant @ Automatic Nation 
YouTube Channel 


Forum|alt.badge.img+5
  • Author
  • New Participant
  • 3 replies
  • November 12, 2025

I tried that approach previously (your line 8 instead of what I had for defining “record”)  but then get a different error:


TypeError: Invalid arguments passed to table.selectRecordAsync(recordId, options):
• recordId should be a string, not undefined


Mike_AutomaticN
Forum|alt.badge.img+28
  • Genius
  • 1547 replies
  • November 12, 2025

Are you shure you are mapping the value correctly on the left panel for variables? Would you mind sending a screenshot of your scropt action block?


Forum|alt.badge.img+5
  • Author
  • New Participant
  • 3 replies
  • November 12, 2025

I ended up resolving this by just using the Inputs pane, so that I don’t have to use code to define what the variables are.


nroshak
Forum|alt.badge.img+7
  • Inspiring
  • 23 replies
  • November 13, 2025

Nice! I agree, the Inputs pane is the way to go.

 

In case anyone else has this q… In the Inputs pane , set “name” to a handy variable name you want, eg “varname” and set its value to the field you want using the blue “+” button. Then you can use that directly in the code like so:

let inputConfig = input.config();

do_myfunction(inputConfig.varname) ;

 

Natalka