Skip to main content

Scripting Block Example - Project design tasks


Attempting to test the sample Project design tasks block - get the following. Any ideas why?

The field is a string


Error: Can’t create records: invalid cell value for field ‘Design project’.
Cell value has invalid format: must be a string
at Mutations._assertMutationIsValid

5 replies

  • Inspiring
  • 192 replies
  • March 1, 2020

Hi Doug – what’s the type of the “Design project” field in your table?

Could you also paste the script you’re running here for easier debugging


  • Author
  • New Participant
  • 4 replies
  • March 1, 2020

Thanks for the response. The script is the example from Fri’s webinar. All of the examples worked except for this one.

// pick tables from your base here
let projects = base.getTable('Design projects');
let tasks = base.getTable('Tasks');

// prompt the user to pick a template for our project
output.markdown('# New project');
let name = await input.textAsync('Project name');

// create the project - change the field name to one in your base
let projectId = await projects.createRecordAsync({
    'Name': name,
});

// create the tasks - change the field names to ones from your base.
// the [{id: projectId}] links the newly created records back to our project
await tasks.createRecordsAsync([
    {
        fields: {
            'Name': 'The first task',
            'Design project': [{id: projectId}],
        },
    },
    {
        fields: {
            'Name': 'Another task',
            'Design project': [{id: projectId}],
        },
    },
    {
        fields: {
            'Name': 'The final task',
            'Design project': [{id: projectId}],
        },
    }
])

output.text('Done!');

This is the tasks table


This is the error code

ERROR
Error: Can't create records: invalid cell value for field 'Design project'.
Cell value has invalid format: <root> must be a string
    at Mutations._assertMutationIsValid (https://cdn.airtableblocks.com/bbnvQSVM77xPXpYP3/bundle.js:1:577400)
    at Mutations.applyMutationAsync$ (https://cdn.airtableblocks.com/bbnvQSVM77xPXpYP3/bundle.js:1:571074)
    at tryCatch (https://cdn.airtableblocks.com/bbnvQSVM77xPXpYP3/bundle.js:1:1996567)
    at Generator.invoke [as _invoke] (https://cdn.airtableblocks.com/bbnvQSVM77xPXpYP3/bundle.js:1:1996172)
    at Generator.prototype.<computed> [as next] (https://cdn.airtableblocks.com/bbnvQSVM77xPXpYP3/bundle.js:1:1997465)
    at tryCatch (https://cdn.airtableblocks.com/bbnvQSVM77xPXpYP3/bundle.js:1:1996567)
    at invoke (https://cdn.airtableblocks.com/bbnvQSVM77xPXpYP3/bundle.js:1:1997721)
    at https://cdn.airtableblocks.com/bbnvQSVM77xPXpYP3/bundle.js:1:1998206
    at new Promise (<anonymous>)
    at callInvokeWithMethodAndArg (https://cdn.airtableblocks.com/bbnvQSVM77xPXpYP3/bundle.js:1:1997629)

Doug_Kaufman wrote:

Thanks for the response. The script is the example from Fri’s webinar. All of the examples worked except for this one.

// pick tables from your base here
let projects = base.getTable('Design projects');
let tasks = base.getTable('Tasks');

// prompt the user to pick a template for our project
output.markdown('# New project');
let name = await input.textAsync('Project name');

// create the project - change the field name to one in your base
let projectId = await projects.createRecordAsync({
    'Name': name,
});

// create the tasks - change the field names to ones from your base.
// the [{id: projectId}] links the newly created records back to our project
await tasks.createRecordsAsync([
    {
        fields: {
            'Name': 'The first task',
            'Design project': [{id: projectId}],
        },
    },
    {
        fields: {
            'Name': 'Another task',
            'Design project': [{id: projectId}],
        },
    },
    {
        fields: {
            'Name': 'The final task',
            'Design project': [{id: projectId}],
        },
    }
])

output.text('Done!');

This is the tasks table


This is the error code

ERROR
Error: Can't create records: invalid cell value for field 'Design project'.
Cell value has invalid format: <root> must be a string
    at Mutations._assertMutationIsValid (https://cdn.airtableblocks.com/bbnvQSVM77xPXpYP3/bundle.js:1:577400)
    at Mutations.applyMutationAsync$ (https://cdn.airtableblocks.com/bbnvQSVM77xPXpYP3/bundle.js:1:571074)
    at tryCatch (https://cdn.airtableblocks.com/bbnvQSVM77xPXpYP3/bundle.js:1:1996567)
    at Generator.invoke [as _invoke] (https://cdn.airtableblocks.com/bbnvQSVM77xPXpYP3/bundle.js:1:1996172)
    at Generator.prototype.<computed> [as next] (https://cdn.airtableblocks.com/bbnvQSVM77xPXpYP3/bundle.js:1:1997465)
    at tryCatch (https://cdn.airtableblocks.com/bbnvQSVM77xPXpYP3/bundle.js:1:1996567)
    at invoke (https://cdn.airtableblocks.com/bbnvQSVM77xPXpYP3/bundle.js:1:1997721)
    at https://cdn.airtableblocks.com/bbnvQSVM77xPXpYP3/bundle.js:1:1998206
    at new Promise (<anonymous>)
    at callInvokeWithMethodAndArg (https://cdn.airtableblocks.com/bbnvQSVM77xPXpYP3/bundle.js:1:1997629)

@Doug_Kaufman

I believe you need to change your “Design project” field in the “Tasks” table to be a Link to another record type, and linked to your “Design projects” table.

Right now that field is just a text field, so it can’t establish a linked record.


  • Author
  • New Participant
  • 4 replies
  • March 2, 2020

The script worked perfectly when I did that.

Thank you


  • Author
  • New Participant
  • 4 replies
  • March 11, 2020
Kasra wrote:

Hi Doug – what’s the type of the “Design project” field in your table?

Could you also paste the script you’re running here for easier debugging


HI - Hey, I figured it out … thanks for the follow up


Reply