I have 20 fields in my table that are named ACH001, ACH002, ACH003, etc. (They’re achievements for a game.)
I want to update a specific field when a user completes the achievement, but I don’t know which one they’re completing until I’m ready to make the update call to the database. So, I’m creating a variable called “fieldName” that contains the name of the field. This doesn’t seem to work, however. I get an UNKNOWN_FIELD_NAME error. Error 422. Anyone have any tips on how I should approach this one?
var fieldName = getFieldName(achievementId);
var airtable = await new Airtable({apiKey: process.env.airtable_key}).base(“appx5AkeU3qgwlYDn”);
airtable(‘User’).update(UserRecord.RecordId, {
fieldName: Date.now()
}, function(err, record) {
if (err) { console.error(err); return; }
});