Help

Re: Automation trouble

1912 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Hala_Elbashier
4 - Data Explorer
4 - Data Explorer

Hey Airtable community,
I am having trouble with this automation script that extracts images from URLs. The URL field name is Pictures URL and the new field is Pictures. But, it keep coming back with this error:

Error: Field “fldzkNbXJlvQonpO3” cannot accept the provided value.
at main on line 54

let submissionsTable = base.getTable(‘Linkedin profiles’);

let urlField = submissionsTable.getField(‘Pictures URL’);

let attachmentField = submissionsTable.getField(‘Pictures URL’);

let submissionsQuery = await submissionsTable.selectRecordsAsync();

let updates = ;

for (let record of submissionsQuery.records) {

let url = record.getCellValue(urlField);

let attachments = record.getCellValue(attachmentField);



// If this record already has an attachment, skip it.

if (attachments !== null) {

    continue;

}



// Otherwise, attach the image at the URL.

updates.push({

    id: record.id,

    fields: {

        [attachmentField.id]: [{url: url}]

    }

});

}

// Update records in batches of 51.

while (updates.length > 0) {

await submissionsTable.updateRecordsAsync(updates.slice(0, 51));

updates = updates.slice(51);

}

2 Replies 2

What is the field type of the urlField? Are you sure that the urlField has a value?

Have you tried using

let url = record.getCellValueAsString(urlField);`

Try using console.log(updates) to see the actual value that is being passed.

Also, your batch size should be 50, not 51.

Hala_Elbashier
4 - Data Explorer
4 - Data Explorer

It worked, Thanks :slightly_smiling_face: