Jan 23, 2017 08:24 AM
Hello,
I am using Node.JS to integrate with airtable.
Got select
to work, however update is not functioning for me. I get the error mentioned in subject. My code is similar to the below:
base('TEST FB Insights Record IDs').select({
view: "Main View",
filterByFormula: "({FB Universal ID} = '" + post.universal_video_id + "')"
}).eachPage(function page(records, fetchNextPage) {
// This function (`page`) will get called for each page of records.
records.forEach(function(record) {
console.log('name: ' + record.get('Name') + ' record id: ' + record.get('FB Universal ID')[0] + ' Facebook URL: ' + "https://www.facebook.com/1234567890/" + post.id + "/");
base('TEST FB Insights Record IDs').update(post.universal_video_id, {
"Facebook URL": "https://www.facebook.com/1234567890/" + post.id + "/"
}, function(err, ur) {
if (err) {
console.log('update error: ', err);
return;
}
console.log('updated: ', ur);
});
});
// To fetch the next page of records, call `fetchNextPage`.
// If there are more records, `page` will get called again.
// If there are no more records, `done` will get called.
fetchNextPage();
}, function done(error) {
if (error) {
console.log(error);
}
});
Am I doing something wrong? The error message seems confusing, though. I never change the app id. Perhaps, I am missing an important piece here. :winking_face:
Thank you
Jan 23, 2017 09:01 AM
Hi!
I think the problem is on this line:
base('TEST FB Insights Record IDs').update(post.universal_video_id, {
The first argument to update
should be the Airtable record ID, so try replacing with:
base('TEST FB Insights Record IDs').update(record.getId(), {
Jan 23, 2017 11:19 AM
Thank you. It worked. Appreciate your help.