Airtable Cobuilder is here! Learn more about our new no-code app creation feature, powered by AI on the Airtable Academy

Scripting: options sourced from input.config.field

728 1
Showing results for 
Search instead for 
Did you mean: 
6 - Interface Innovator
6 - Interface Innovator

Hi all!

Pretty new to this, but I'm trying to write a script similar to Airtable's child-record script. The script should: For parentTable (defined in config), when a record's value in a field (singleSelect defined in config) matches conditions (defined in config), then it should assign this record as parentRecord, and create a link child-record in a childTable (defined in config) and populate this record's primary field with the value from the parentRecord's primary field. 

I am having some issues with the config, and wondered if anyone knew how to fetch the options of a field specified in input.config.field so it appears as the options in a dropdown list. I want to avoid hard-coding it, but it is an easy workaround if it's impossible.

Here's the code I have for the config.


const config = input.config({
        title: `Conditional Parent-child record creation`,
        description: `For records in a parent table with a matching value of a designated field, this script will create a
        number of "child" records in another table, where each "child" references the "parent" through a Linked Record field.`,
        items: [
            input.config.table('parentTable', {
                label: 'Parent Table',
                description: 'Select the parent table',
            input.config.field('fieldToCheck', {
                label: 'Field to check',
                description: 'Select the field containing the value to check',
                parentTable: 'parentTable',
  'valueToMatch', {
                label: 'Value to Match',
                description: 'Select the value to match records in "Field to check" against',
                options: [
                    //this section is unknown


 My first idea was to define a variable fieldToMatchValue before the config variable is defined, and reference back to this value when writing the options (under'valueToMatch', { etc…)

Anyone know of a way to do this?

The purpose of this is primarily multi-language workflows, where the parentRecord is an English string, and theres a child-record for each English string for many languages in a different table. The fieldToCheck is a single-select field indicating the status of the record in a workflow, "translation" being the final stage before "done". The translators would automatically be assigned a record based on the language-tag associated with it, through an automation that checks a table of language-assignments against a user upon the record being created, and assigns the relevant employee. 

Appreciate all help! 

1 Reply 1
4 - Data Explorer
4 - Data Explorer

Are you still looking for help on this? I think it's been almost a year, so...