Skip to main content

I'm not familiar with Javascript.

Looking to make a button that will start a script to generate an alphanumeric string that's 8 characters long.  

The code I found on Google to generate a string is:

function makeid(length) {
var result = '';
var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
var charactersLength = characters.length;
for ( var i = 0; i < length; i++ ) {
result += characters.charAt(Math.floor(Math.random() * charactersLength));
}
return result;
}

console.log(makeid(8));

However, I'm not sure how to make it output into a record in a table in Airtable.  Is it possible to make it replace the same record every time the button is pressed?  Is it possible to clear the record after x amount of time?

 

Yeah sure, here:

Base link

> Is it possible to clear the record after x amount of time?
Yeah, create a "Last modified time" field that looks at the field with the random string, create a formula field that will check whether it's X amount of time since it was last updated, and get an automation to trigger off that and clear the value


Reply