Last active
April 1, 2019 13:34
-
-
Save nabrown/a759143bc3c56a93e538209309c386c4 to your computer and use it in GitHub Desktop.
Fetch the highest record from an Airtable base called 'Invoices', add 1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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