Oct 18, 2023 11:55 AM
I want to get the creation date of my records and I can't figure out what the variable is.
Is there way I can get it, like I can get the record ID (record.getId()). I have tried record.getDate(), record.createdDate()).
Here is what I have:
return new Promise((resolve, reject) => {
base('Resource').select({
sort: [
{ field: 'Type', direction: 'asc' }
],
filterByFormula: 'AND({Type} = "'+type+'")'
}).eachPage(function page(records, fetchNextPage) {
records.forEach(function(record) {
console.log(record.getId());
console.log(record.getDate());
});
fetchNextPage();
}, function done(err) {
if (err) {
reject("Promise Rejected");
} else {
resolve(tldList);
}
});
});
Solved! Go to Solution.
Oct 19, 2023 12:11 PM
Thanks for the screen shot. Since you can see the createdTime in the object, have you tried getting the value directly, without using a function (record._rawJson.createdTime)?
Oct 18, 2023 06:02 PM
The library you are using might have been written before Airtable added createdTime of records to its API.
Create a “Created” field that shows when the record was created and then use that.
Or use a different library that has support for created time.
Or don’t use a library at all and make your own API calls directly. Then you can refer to the API documentation directly for how to get the createdTime.
Oct 19, 2023 06:56 AM
I'm using the airtable.js library (https://github.com/Airtable/airtable.js). What library supports created time? I can see the created time when console logging but it's part of _rawJson. So I'm a bit confused on why I can't get created time.
Oct 19, 2023 12:11 PM
Thanks for the screen shot. Since you can see the createdTime in the object, have you tried getting the value directly, without using a function (record._rawJson.createdTime)?
Oct 19, 2023 12:47 PM
That seems to work! Thank you