Object ID numbering

My question has been asked with variations in these forums, but I wasn’t able to get the results I wanted from what I found.

I am creating a new database for a museum. We want to give each object a unique identifier. None of the 3,000+ objects have any kind of number assigned to them. Let’s call this field Object ID. I have another field called Object Type that has 4 choices (Tool, Musical Instrument, Action Model, Other). I would like the Object ID to be assigned automatically based on the record number but prefixed like this:
TO0004 which means Tool #4
MI0017 which means Musical Instrument #17
AM0004 which means Action Model #4

So the sequence of numbers would start over for each type of object. And this could happen after one selects the object type from a drop down menu before the form is submitted. It would be in an uneditable field and just display the object ID. This number can never be changed.

Do I use scripting for this?
Thanks in advance for you help. I am completely new to Airtable.

Yes. I suggest setting up an automation to take care of this. Because you’re using a form to add items, and the item type is set in the form, and is therefore part of the record when it’s created, this should be fairly smooth using the New Record trigger for the automation. In short, the script would collect all records from the table, filter that list down to only those of the type matching the newly-added record, and output the proper object ID with the appropriate number. The script itself could update the {Object ID} field, or output the value for an Update step to take care of.

If you’d like help writing this script and/or setting up the automation, just holler!

I tried to do a few things and couldn’t even come up with the first line of text. I did create a second table that will populate a field with the abbreviation for the Object Type so that the first 2 characters of the auto-generated Object Number will be picked up from these abbreviations.

I would like help, but in the form of supervised guidance. For example, don’t write all the code for me, but start me out with one line and tell me what I should do next. I know javascript (though it has been years since I used it).

Happy to guide as requested! :slight_smile: However, I’m tied up for the rest of the day, so the earliest I can put the first steps together would be tomorrow morning. If that somehow doesn’t happen, then Monday would be the next soonest opportunity.

1 Like

Thank you Justin. How can we work on this together? I’m available all day today.

Monday is one of my busiest days lately. I’ll ping you via PM once I’m able to get some first steps outlined.

This topic was solved and automatically closed 15 days after the last reply. New replies are no longer allowed.