I’m using the Airtable API in Wix to create an entry in one of my bases. I can get the entry to create no problem, the issue is I would like to return the entry id after the creation and it returns ‘undefined’. See me code below, I can get the id number to print out at the point shown, but I can’t send it out to my other functions.
I’m pretty new to this, I’m sure it’s just a simple oversight, thank you in advance.
export function getCustomer (){
var nCustomer;
base('Customers').create({
"Name": "John Smith",
"Orders": >
]
}, function (err, record) {
if (err) {
console.error(err);
return;
}
nCustomer = record.getId();
//console.log here I get the record id
});
//console.log here, returns 'undefined'
return nCustomer;
}