Help

Re: Scripting Block Example - Project design tasks

1868 1
cancel
Showing results for 
Search instead for 
Did you mean: 
Doug_Kaufman
5 - Automation Enthusiast
5 - Automation Enthusiast

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 5

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

Doug_Kaufman
5 - Automation Enthusiast
5 - Automation Enthusiast

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
2020-03-01_16-24-20


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.

Doug_Kaufman
5 - Automation Enthusiast
5 - Automation Enthusiast

The script worked perfectly when I did that.

Thank you

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