Apr 02, 2024 02:24 PM
Just to be clear. When I add a lookup field to a table, that field is not accessible direct through `
Solved! Go to Solution.
Apr 02, 2024 05:05 PM
Doing a 'getCellValue' on a lookup field gives me the value of the lookup field in an array:
Apr 02, 2024 05:04 PM - edited Apr 02, 2024 05:08 PM
If you’re talking about scripting, this depends on the type of data you’re looking up, and where you’re running the code from.
Regardless of the data type, I think getCellValueAsString() should work to return the value as a string. I’m on my phone so haven’t tested, but I believe that’s the case.
A bit of annoying nuance - if you’re looking up a linked record field, getCellValue() will behave differently in a script extension vs. an automation step. In the extension it should return an array of objects containing the id and name of each linked record in the lookup field. In an automation step, I believe it returns an array of strings containing only the ids.
Apr 02, 2024 05:05 PM
Doing a 'getCellValue' on a lookup field gives me the value of the lookup field in an array:
Apr 02, 2024 05:25 PM
wow. 😲
I've just been calling the field by the field name. However when I tested using the field's actual ID, I got the array as you guys pointed out. Then I tried using the field name as displayed and got the array.
Example: I have field called `user` in table A. In table B I create a Linked Record that displays `user` in table B. I was looking up the field as `user`. However it's actually `user (from linked_record)`. Never would have figured that out.
thanks a ton, this really helps me out a lot. I've been making so many unnecessary queries today to get around what I thought was a limitation.
fwiw, I'm doing pretty much everything through external node scripts using the AirTable node library.