Update a record with script output, not updating correct field?

I’m a little bit lost on this one and hoping for some help from the community. I’ve been using this automation without issue for months, but recently something changed and now it’s throwing me an error. (I’m guessing something updated on Airtables end).

I have an automation which runs whenever a customers record is updated (which includes a rollup field of their orders). I then run a script to take the customers linked order records and sort them, so that newest orders show at the top. Up until this point, everything is working as expected, and the output of the script is a sorted list of the linked record ‘names’ (which in this case are Order ID’s, like 12345).

The next step, ‘Update a record’ is where I’m now getting the error everytime this automation runs. It should (as before) take the output of the script and update the linked ‘Orders’ field in the customer record that changed, triggering the automation. That’s all it does, not changing any other fields.

Now, I’m getting an error saying: ‘Field “Order ID” cannot accept the provided value: Cannot modify a computed field.’

The confusing part, is I’m not trying to update any Order ID’s (which are only a field in the Orders table, which is not even what I’m updating). I’m only updating the ‘Orders’ field in the Customers table for whichever record triggered the automation.

Any idea what might have changed to cause this? Or, any ideas to work around it? The outcome I want is just to update the linked ‘Orders’ field in a Customer record with my sorted list.

Let me know if you have any questions or need more information. Any and all advice is welcomed and appreciated. Thanks!

Edit: Looks like there are several others who have run into this issue after something changed recently. It seems that using the record ID’s directly in the linked field may be a solution, but unfortunately for me I need to use the record ‘names’ to sort it properly (ie, 10003, 10002, 10001).

If you’re using a script already, can’t you just sort the records by the name and then return only the ID after they’ve been sorted?

Other people are reporting the same issue with automations that update linked records failing. I suspect that Airtable changed things behind the scenes with a breaking change. I recommend contacting customer support.

In the meantime, since you have a script, I echo Kamille’s recommendation to use record IDs in your script to set the linked record field.

The breaking change, I believe, is that if the primary field of the table being linked to is a formula (or some other calculated field), the Automation now throws an error because of the possibility of one or more from a given list of “names” not existing in the table. Ideally, it would only throw an error if those records don’t exist (since the Automation wouldn’t be able to modify a calculated field to create a new record that would match the missing names).

In a perfect world the field names which do exist, regardless of whether the field is calculated, would carry through.

Unfortunately, because it’s an input variable, it only let’s me take either the names or the record ids, but doesn’t have an array with both.

I’ve been thinking and I could grab both, combine them, sort them by name, then take the record ids. It’s not as streamlined of a solution as I’d like, but should work. I’m sure there is a better way, but I’ll have to try something as this is for an active small business CRM and need to get it working again quickly.

If you have any ideas on a better way to do this, I’m always ears :smiley: Maybe if I select the field values in the script manually (rather than an input variable).

@kuovonne I’ve actually been trying to contact support, but I cannot locate the email to do so anywhere. Everything references to use the ‘in-app menu’, but the button doesn’t seem to work. (In Airtable, clicking help, then hitting ‘contact support’ does nothing for me).

Sent an email to sales, asking for the support email and reporting my issue =P When it rains, it pours!

Yes, that’s exactly what I was getting at. In a script when you return a list of records it comes in the form of an array of objects, each object having the record name and the record ID. Seems like you just need a basic Javascript .sort() function using the name property and then map the filtered array to just the IDs.

support@airtable.com

@Kamille_Parks Thanks again for the message. I have actually been using sort() for the past months with no problem on the list of record ‘names.’

Would be a lot easier if I could just use an input variable that had both record ids and name, but as I mentioned it will only give the option of one or the other (so I’ll need to manually combine them into an object, then sort that). Hoping I’ll have a bit more time tomorrow to dig in and try some potential solutions.

Thank you @kuovonne, that seems obvious in hindsight =P Much appreciated.

Why not edit the script so that the script updates the record, instead of passing the variable to the update action?

1 Like

@kuovonne I actually did attempt that, but the same error was thrown (when trying to update a linked field with a list of record ‘names’).

The good news, is that Airtable appears to have fixed whatever was causing this behind the scenes.

The automation is now working as it was before. =) Thank you all for trying to help in the meantime, I really appreciate this community of awesome people.

1 Like

Glad that Airtable’s fix worked for you. However, if anyone stumbles across this thread in the future, I want to clarify that I was suggesting that the script updating the linked field with an array of Airtable’s internal record ids, not record names. If a script has record names, it can match up record names with ids (or extract the ids at the same time as the names).

1 Like

This topic was solved and automatically closed 3 days after the last reply. New replies are no longer allowed.