Automation script to update single select field from form selection

Topic Labels: Automations
1548 2
Showing results for 
Search instead for 
Did you mean: 
4 - Data Explorer
4 - Data Explorer

Hello airtable scripting experts. I am building an automation using a script to update a single select field in a table from a form in another table. For context, this is a CRM, and the form is updating the lead stage after an interaction occurs. I want the updated lead stage in the form to update the single select stage in another table (accounts table). It seems the only way to automate this is through a script in an automation. With some troubleshooting, I’ve written some code to send the ‘NewLeadStage’ to the proper record, but am receiving an error that the field is not accepting the provided value. Can anyone help me troubleshoot my code?

See screenshot below:

Screenshot 2022-09-23 012204

2 Replies 2

Welcome to the community, @Tyler_Curran! :grinning_face_with_big_eyes: On the surface the script looks okay, at least in terms of syntax (there are some unnecessary/redundant bits, but that won’t affect what you’re trying to accomplish). That means the data is probably to blame (at least partly).

In this case, I would closely compare the options in the relevant single-select fields. Chances are the option you’re trying to set in the target table isn’t a 100% match for the one coming from the form. They have to be exactly the same: same case, same punctuation, same use of spaces (or lack thereof), etc. For example, “First” and “first” won’t be considered the same and will throw that error you’re seeing. It’ll also throw an error if it’s “First” in one and "First " in the other (notice the space at the end of the second option). Once you’re certain that the options all match exactly, my gut says it’ll work.

Wow, it was definitely a spelling error. Appreciate the insight!