I just found a scenario where a custom record crea...
# suitescript
s
I just found a scenario where a custom record created ~5 minutes after another custom record (same record type) has an internal id less than the one created first. I always assumed the internal id is always increased each time a new record is created, but that doesn't appear to be the case?
b
No such requirement
Its why internal ids are unreliable for sorting
s
@battk sorting by date created is the only reliable way?
b
Probably not the only, but it is the most obvious
s
Any other ways you know out of the box without some customizations?
c
It depends what you're trying to achieve. Often uniqueness is actually sufficient for a given application, it's the humans that want to complicate things. Add a last modified/created timestamp to the record if you need sorting
b
You probably want to list whats wrong with the created date
s
It's likely fine unless there are know issues such as NS only tracks down the to second and it's not clear how sorting would work if two records are created in the same second.
I'm really just interested in making sure records are always sorted in the correct order and that the last one created is always the last in the list. Most likely the created date will be fine.
Seems like the only "out of the box" option that exists since internal id can't be relied upon.
c
Internally in NS, it's probably the way Oracle sequence caching works, with different RAC nodes assigned batches of sequence values
b
you could try using internal id as the second sort, but created date works for me by itself
s
yeah seems like overkill to use both
s
I'm pretty sure I had netsuite confirm that internal ids are monotonically increasing numbers
it also has the secondary suggestion of using autonumbering, which may be an option for you for a custom record
s
"The assignment of internal IDs to new records *is sequential*" ...... "However, the sequence of internal IDs does not indicate when or in which order records were added."
That makes no sense to me, but at least they call out at the bottom "The internal ID of a record should never be used to determine when data was entered"