I’m trying to refactor a script that I wrote that is working with a button into a triggered automation. I’m passing the variable “triggeredRecord” using input.config() but for some reason I keep getting the error “TypeError: testRecord.getCellValue is not a function”. I made a test record (testRecord) and I’m getting the same error. What am I missing here?
The main goal here is to just keep “triggeredRecord” available so I can target it using “updateRecordAsync”
Welcome back to the Airtable community!
The value you receive from input.config for “triggerRecord” is probably the record ID, which is a string, not an actual record object. In order to use
getCellValue you need to have a record object, not just the id.
If you only need the cell value, and not the entire record object, you can pass the cell value into your script using input.config().
You can also run
updateRecordAsync using only the cell value from input.config().
I really appreciate the quick response! I messed around with this approach for a while and it still doesn’t seem to fully fix my issue, although it was helpful for me to get my head around the use of input.config().
Unless I’m mistaken, it seems like when I pass in a lookup field cell value into the script it will only let me get the length, but not the array.
Is there a way to get the actual record object or recreate it or search and filter to get it?
What didn’t work with it? Can you post a screen capture? You should get an array that you can loop through.
You can get the record object in automations. However, you have to do a
selectRecordsAsync on the entire table/view, which gets all of the records in the table/view. Then you need to pick out the specific record you want based on the record id. That’s a lot of work compared to getting the value through input variables.
Okay thanks for you help with this. When I originally tried “Make a new list of…” there was only 1 item in that list. So I updated the field, and then retested the trigger but it never pulled multiple in. Every time I tried it I got “1” instead of “1,1,1”.
I just changed the trigger to a new table and then changed it back to make sure it was actually re-testing and that fixed it! I thought that was how that should work but I guess that “test again” doesn’t pull in updated data.