Skip to content

Instantly share code, notes, and snippets.

@nabrown
Last active April 1, 2019 13:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nabrown/a759143bc3c56a93e538209309c386c4 to your computer and use it in GitHub Desktop.
Save nabrown/a759143bc3c56a93e538209309c386c4 to your computer and use it in GitHub Desktop.
Fetch the highest record from an Airtable base called 'Invoices', add 1
setNextInvoiceNumber(){
base('Invoices').select({
maxRecords: 1,
sort: [{field: "Number", direction: "desc"}]
}).firstPage((err, records) => {
records.forEach((record) => {
this.invoiceNumber = record.get('Number') + 1
});
}, function done(err) {
if (err) { console.error(err); return; }
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment