How to create an airtable record and insert a value in a lookup field?

I have (mostly) built a database that tracks the components, manufacturing costs, etc of a product. One table is for orders, and contains a lookup field for the ordered product’s SKU.

I would like to have new Etsy transactions trigger creation of order records, but when I drag the “SKU” field from the Etsy integration into the airtable “Products” field and do a test run, it gives me (for example): “The operation failed with an error. [422] Value “SP4-O-PB-14Y” is not a valid record ID.”

I am very new to all of this so I may be doing something obviously wrong, but I’m kind of lost.

image

Hi @ac85,

Since that field is expecting a record ID, but you’re passing it a value, you’ll need to first look up the record ID where the title of the record matches 3. SKU.

You can try using Airtable Search Records module first, then the Record ID from the result may be passed in to Record ID under Products.

Hope that makes sense, and hope it helps!

3 Likes

That actually does make much sense @Donald_Mitchell, now that I’m thinking about it! Thank you! Since I have you, I presumed this wouldn’t work (and in fact did not), so being unfamiliar with how airtable search queries work, can you point me to how I can formulate this?

Search1
Search2

Your formula should be as you would write it in Airtable’s formula builder.
Formula would be something like {SKU Field Name} = {{3. SKU}}.

That would return the record and any output fields you’ve selected.
You won’t need the output fields because you’re only interested in the record ID which should get returned regardless.

3 Likes

Thank you, with your help I managed to get on the right path to learning how to implement what I was trying to do, and have gotten this aspect of it down. Very much appreciate the guidance!

@Donald_Mitchell one more question for you! I got this working with the “list transaction” trigger, but when I try the exact same setup with the “watch transactions” trigger (so only new orders are entered), I get a “[422] Value “null” is not a valid record ID.” error on the creation of the record stage. Any ideas why that might be?


Noting here that I actually figured it out. Because I had not set the “choose when to start” date, it started grabbing the oldest orders, before I had the SKUs set up on Etsy’s end–and it doesn’t retroactively display them on orders placed before they were inserted in the listing. So that certainly explains where the “null” came from. Once I set it to start from today, it started functioning properly!

3 Likes