Onit Documentation

App Builder Best Practice: Using Atom ID to Create a Unique Record Identifier

by Michael Nadeau Updated on

It can be useful to tag your records with a unique identifier that doesn't change. Some advanced implementors have realized that the database which underlies App Builder gives its records an ID, and have leveraged this ID for those purposes. ( {{ atom.id }} can be retrieved by Liquid.)

Unfortunately, the database ID is not intended for this purpose, and it is unsafe to use it this way. Why not? Because the database ID isn't necessarily stable. Right now, many corporations are being moved from the Mongo database to Postgres, and this causes the atom IDs to change. And who knows what other refinements may arise in the future? The development team can't guarantee that using the database ID is a safe thing to do.

Does this mean that the ID is useless? No — it just means you have to be more thoughtful about it. The best practice is to use the database ID to set a field on the record: on atom creation, use a Transaction Created business rule to fire an Update Transaction action which stores {{ atom.id }} in the field. (Naturally, this field should have a hidden condition of true, and probably should be set not to show on the dashboard grid either.)

Once you've done that, you then just don't ever do anything else to that field, and it becomes an unchanging identifier. As a bonus, it also becomes accessible to Raw Transaction Filters.

Previous Article Status vs. Phase?
Next Article Bulk Import

© 2024 Onit, Inc.

docs.onit.com contains proprietary and confidential information owned by Onit, Inc. that is subject to copyright. Onit presents it exclusively to you for your sole use in conjunction with using Onit products. No portion of the materials contained herein may be used for any other purpose. No portion of the materials contained herein may be shared with third parties or reproduced in any form.