"Create records from multiple select field choices" script

Hello! I am a first-time poster using the following template script which is part of the Airtable +Add an app section (script below).

I am using Airtable for hiring. Within my Applicants table, I have people (field name: Applicant Name) who have applied for multiple positions (field name: Active Positions Applied For) of which some are under consideration (field name: Active Positions Under Consideration). I am looking to automate rejection and advancing to next stage emails but am running into difficulty with the following scenarios due to multiple selection:

  • Candidate applies for 2+ positions, of which 0 are under consideration – want to send separate rejection emails to positions applied for (current automation sending as one combined email only)
  • Candidate applies for 2+ positions, of which 1 is under consideration – want to send rejection email to position not under consideration only
  • Candidate applies for 2+ positions, of which 1 is under consideration and then later no longer under consideration – want to send separate rejection email to both without duplication / re-sending original
  1. Would creating a child table (table name: Test) off the parent (table name: Applicants) data using the script template resolve this issue as I can build automations based off single rows in the child table? Eg. Person applies to 3 positions and each position is handled separately with separate reject / advance email

  2. Getting an error on Line 36 when I run script below: TypeError: Cannot read property ‘length’ of undefined at main on line 36

  3. Not sure that I have chosen my 5 options correctly. Essentially, I want all data in Applicants table to be shown in the Test table but with each position applied for and subsequent position/s under consideration being its own row eg. applied for and under consideration Position A = 1 row

  4. Is there an alternative way to turn a multiple select into separate rows all linked to the same person?

  5. Is there an IF statement or formula for only sending separate rejection emails to Active Positions Applied For that DO NOT MATCH Active Positions Under Consideration?

  6. Any recommended resources to address my goals are appreciated!

Thank you for your help! Script below.

Airtable - Create records from multiple select field options

// Script settings
let s = input.config({
title: ‘:part_alternation_mark: Create records from multiple select field options’,
description: ‘Creates 1 record in another table for each option in a multiple select field in the source table, and links the new records back to the source record.’,
items: [
// Source table select
input.config.table(‘tableSource’, {
label: ‘:fallen_leaf: Table with existing records’
// Source table: Multiple select field with deliverables
input.config.field(‘delivField’, {
parentTable: ‘tableSource’,
label: ‘:fallen_leaf: Multiple select field with names of records to create’,
// Destination table select
input.config.table(‘tableDest’, {
label: ‘:seedling: Table to create new records in’
// Destination table: Name or title field
input.config.field(‘destinationField’, {
parentTable: ‘tableDest’,
label: ‘:seedling: Deliverable name or title field in destination table’,
// Destination table: Linked record field (back to the Source table record)
input.config.field(‘projField’, {
parentTable: ‘tableDest’,
label: ‘:seedling: Linked record field (links to table with existing records)’,
// You can use a button field that points to this script to run it for specific records,
// or you can run the script directly, in which case the following prompts the user to pick a record
let r = await input.recordAsync(‘Pick a record’, s.tableSource);

// Gets the desired # of records to create, and deliverable names, based on the fields chosen in the script settings
let recToCreate = s.delivField.options.choices.length;
let deliverables = r.getCellValue(s.delivField.name);

// Variables to store the applicable deliverable names and length (total records to create)
let delivNames = ;
let length = 0;

if (deliverables) {
// Creates record names from ‘deliverables’ multiple select field, if any
for (let item of deliverables) {
‘Name’: item.name
length = delivNames.length
// Preview records to create, prompt user to confirm creation
output.markdown(’### Create ’ + length + ’ records for ’ + r.name + '?’);
await input.buttonsAsync(’’, [{ label: ‘Create records’, value: ‘Create records’, variant: ‘primary’ }]);
// Create records
let dToCreate = ;
for (let i = 0; i < length; i++) {
let name = delivNames[i].Name
fields: {
[s.destinationField.id]: name,
[s.projField.id]: [{ id: r.id }]
// Batches the creation
while (dToCreate.length > 0) {
await s.tableDest.createRecordsAsync(dToCreate.slice(0, 50));
dToCreate = dToCreate.slice(50);
// Output confirmation for the user
output.markdown( ${length} records created ✅ );
} else {
output.markdown(**No deliverables chosen for this record. Make selections in the ${s.delivField.name} field first.**)

Hi Hillary! Welcome to the community :slight_smile: I’m with our support team, and wrote that script, so I’m happy to help.

I replied to your email that came into us at support, so please feel free to reply there! Otherwise, let me know if you have any questions.