Skip to main content

Hello,

 

I’ve got a Bookkeeping Airtable Base and have created a record review interface for the user to review new records, created with transaction info pulled from their banks. They’ve got to make sure they categorize the transaction and that it has something written into the Vendor field, then they hit the “save” button, which I created to run an automation that updates some things behind the scenes, crucially, pasting the value of a formula field (that adds up the Vendor field plus the transaction year) into a linked field called Merchant, and then marking that record as “reviewed.”

So far it’s been going wonderfully, but I ran into an issue when a user told me they hit “save” but nothing happened, and going in I realized that the automation only works when there is already a record in the linked Merchants tab with the correct Vendor+year combo. If this transaction is from a brand new vendor, the automation doesn’t work, because – as I learned by checking out the Airtable Community posts – Airtable doesn’t paste text into linked fields via automations apparently, even though when I manually paste text into a linked field it DOES create new records in the linked table automatically. The error message I’m getting is: “Field "Merchant" cannot accept the provided value: Could not find matching rows for string.”

Per my reading on the topic, the only way to get it to create a new record in the linked table is by running a scrip (please correct me if I’m wrong here). I’m not really knowledgeable in that area, so I tried it with the help of ChatGPT (I’ve successfully created a script that works great that way once). It came up with this:

 

// Define the input variables
let inputConfig = input.config();
let transactionId = inputConfig.transactionId; // The ID of the record in Transactions
let merchantFormulaValue = inputConfig.merchantFormulaValue; // The value from Merchant Formula

// Log the input variables for debugging
console.log("Transaction ID:", transactionId);
console.log("Merchant Foramula Value:", merchantFormulaValue);

// Define the tables
let transactionsTable = base.getTable("Transactions");
let merchantsTable = base.getTable("Merchants & Tax Docs");

// Check if the merchant already exists
let existingMerchants = await merchantsTable.selectRecordsAsync();
let existingMerchantRecord = existingMerchants.records.find(record => record.name === merchantFormulaValue.trim());

let merchantRecordId;

if (existingMerchantRecord) {
// If the merchant exists, use its ID
merchantRecordId = existingMerchantRecord.id;
console.log("Found existing merchant record:", existingMerchantRecord);
} else {
// If the merchant does not exist, create a new record
let newMerchantRecord = await merchantsTable.createRecordAsync({
"Name": merchantFormulaValue.trim() // Adjust the field name if necessary
});

// Retrieve the ID of the new record
merchantRecordId = newMerchantRecord.id;
console.log("Created new merchant record:", newMerchantRecord);
}

// Log the merchant record ID before updating
console.log("Merchant Record ID:", merchantRecordId);

// Update the Transactions record with the linked Merchant
await transactionsTable.updateRecordAsync(transactionId, {
"Merchant": s{ id: merchantRecordId }] // Adjust the field name if necessary
});

these are the input variables:

 

And this is the result I’m getting:

 

 

Is this code nonsense? I sure cannot tell! 🤷 


If anyone has any insight into this I’d be ever so grateful. I could swear I’ve successfully had an Automation create new records in a linked table by simply pasting a value into the linked field, but for some reason it doesn’t want to do it this time and I don’t know why. Thank you all so much!

Hmm, using an automation to paste in the value should work fine.  I just tested this here

Could you provide some screenshots of your tables?  Is the primary field of the linked table you’re trying to create records in a formula field?  If so, that might be causing the problem


@annebocc 

You don’t need a script to do this, because new vendors (I.e. new linked records) are always automatically created by Airtable in the linked table — as long as the primary field in the linked table isn’t a formula field.

Additionally, if you’re creating new records through the REST API by using a tool like Make, then you also need to make sure that “typecast” is enabled (which is called “Smart Links” in Make).

If the linked table’s primary field is a formula field, then it would be best to change it to a normal single line text field. (But if you don’t want to change it to a normal text field, then you can just import the vendor information into a different field, and then have an automation create the linked record for you.)

Hope this helps!

If you have a budget and you’d like to hire the best Airtable consultant to help you with this or anything else that is Airtable-related, please feel free to contact me through my website: Airtable consultant — ScottWorld


Hi ​@ScottWorld  and ​@TheTimeSavingCo , thanks again to you both for responding so quickly!
So I thought the same as what you’re both saying, in fact this automation had previously worked without an issue, automatically creating new linked records. I don’t have the primary field set to a formula (ran into that issue before), it’s just a single line text. I don’t understand why it won’t run, or what that error message even means. Screenshots below, if you spot something I’m missing, please let me know:

I’ll note that the rest of the automation includes pasting other values into other linked fields and those don’t seem to be causing an issue. Also, when I got into the data layer to try and manually paste the Merchant Formula cell into the Merchant linked field, it won’t copy over for some reason! The little dialogue box at the bottom left of the screen says “paste complete | undo” but nothing happens, whether I drag it over with the cursor, or do a controlC controlV! What is going on??? I’m stumped.

 

 


In your Merchant table, is the primary field a formula field?

If so, that is the problem.

If not, you will need to check the permissions in your Merchant table. Check BOTH the table permissions AND the field permissions for the primary field in that table.

Make sure that automations are allowed to create new records, and that automations are allowed to edit the primary field.

Hope this helps!

If you have a budget and you’d like to hire the best Airtable consultant to help you with this, please feel free to contact me through my website: Airtable consultant — ScottWorld

 


Hmm, any chance you could include the Fields dropdown from the error screenshot?

You mentioned it’s not a formula primary ID field issue… considering you can’t copy paste it over either makes me think your formula output is not formatted as a string, so the Text Field in the Merchant table is having difficulty parsing it. Seeing that last screenshot you included, it seems like your formula is reading a date field somewhere (hence the “2025”s). It might also be useful to see the Merchant Formula too...


Hi again – I have the Primary Field in the linked table set as a single line text field. I went in and double-checked all permissions, and both the field and table are set to “Editor or above” which I am (I’m the base creator and it’s not shared with anyone else anyway). I don’t exactly know where I’d check to see if the automation is allowed to create a new record, if you could point me in that direction I’d be grateful. I checked all the steps of the automation and it seems to be set up correctly (and it works for other records!). I still can’t figure out why the error message is “Field "Merchant" cannot accept the provided value: Could not find matching rows for string” rather than the “insufficient permissions” one we sometimes see.

Also, back in the data layer, I copied the content of the Merchant Formula field into the Merchant field for another record and it worked perfectly, but for some reason this one (and a few more I’ve tried) just won’t copy over, manually or by automation. I can’t seem to find the pattern behind it! I’d thought it was the fact that the transaction was trying to link to a brand new record in the linked table, but I just tried it again with a different record where that would be the case, and it worked! So my question I guess is really why won’t it work consistently, and what does this error message mean?

Anyway thanks for looking into this with me, I appreciate it.


Hi ​@DisraeliGears01, here are the extra screenshots you asked for:

 

Let me know if these tell you anything I’m not seeing. Thanks!


I copied the content of the Merchant Formula field into the Merchant field for another record and it worked perfectly, but for some reason this one (and a few more I’ve tried) just won’t copy over, manually or by automation. I can’t seem to find the pattern behind it! I’d thought it was the fact that the transaction was trying to link to a brand new record in the linked field, but I just tried it again with a different record where that would be the case, and it worked! So my question I guess is really why won’t it work consistently, and what does this error message mean?

 This just makes me think more that something in your Merchant Formula field is compiling a data element that can't be interpreted by the Single Line Text field. Whenever that element is blank it would work fine, but when it’s included it spikes the field. Usually AT is good at stringifying things but sometimes you end up with some component it doesn’t want to play with 🤷‍♂️


Hi ​@annebocc,

If you’ve already got the permissions set to “Editors and Up”, then you’re already good. That setting automatically allows automations.

You’ll notice that if you change the permissions to something else, then there is a toggle switch for Automations.

Oh also, I totally forgot to mention that you should ALSO check the field permissions on your linked record field in your main table. Make sure that your automations are allowed to edit that linked record field.

If that doesn’t solve it, then I’m not sure what the problem is. As ​@DisraeliGears01 mentioned above, maybe there’s something strange about your formula result where it doesn’t like being pasted into the linked record field.

You might need to open a support ticket with support@airtable.com to have them investigate.

- ScottWorld, Expert Airtable Consultant


Thank you both! I think I’ve figured out the bug: it was hard to see in the data layer because my row height was set to the lowest size, but in the interface it’s easier to catch: the records that didn’t want to work had a \n in the transaction name and vendor field (and therefore the Merchant Formula created based on the vendor field). I guess some banks’ info gets downloaded a bit funky…? Once I deleted the extra line, everything worked perfectly! 

Thank you ​@ScottWorld  and ​@DisraeliGears01 for helping me work out the issue by process of elimination here! Appreciate it :)


Haha, that’s great!! Glad you were able to solve it! :)


Darn sneaky line breaks! 😆