Automatic Reference doesn't create reference automatically with API

Thinking about this further.

Generating unique sequential numbers via distributed processing is a non trivial problem. Reliably achieving it requires

  • record locking / multitasking synchronisation, exposing Manager core code to lock up and or loss of synchronisation reporting, or
  • External code search next number, post to Manager, then check it is still unique & update if not.

Not as simple as Manager core adding the unique sequence number .

3 Likes

It’s refreshing to see that everybody agrees that additional complexity isn’t an end goal, my vote included, but still removing the auto reference from the documentation isn’t providing an alternative method. We need to talk about that as well.

TLDR alert! :grin:

I tried multiple ways to get the largest reference number used:

  • Using external sequence, this will only work if I had no manual entry.

  • Using the {UI webpage}.json which didn’t work because the Json file doesn’t support query strings, so I get stuck with the overdue references first.

  • Scraping the UI for the page counters. That would work if only users aren’t allowed to type in their own references. Plus, deletions could cause duplicate references.

  • Using the {object type}.json file, which is by far the most effective method but it had one flaw which is that despite it being a single text file, some files are relatively large (2+ MBs). This isn’t a problem if it’s loaded once but when you consider that someone is probably manually posting something then it’s a good idea to refresh that file before each post. Now continuously loading these 2MB files is costly, otherwise you risk duplicating references.

  • Lastly, I created a custom field to store a batch reference which is externally generated combined with a new sequence of references starting at 1 for each batch. Aside from the initial erratic references before manual references catch up to the typical size of a batch, this seems to do the trick just fine for me and that’s the method I stuck with so far.

Despite that, I still think that serializing everything would be nice that’s why I think that if we could query the API for the next number in line that would be just extra sweet.

1 Like

@ShaneAU could you please share more detail on how you got your largest reference number? Namely, if that involved retrieving the full list of objects or using external references?

I went the easy way out and used an external reference. In this use case, no manual entry was fine.

Where manual entry is needed too, there’s no good solution - as you elaborated quite well in your post.

Since automatically incrementing the ID already exists as a Manager feature, that logic is already defined. My hope is that the API can hook into that existing logic, with little extra effort. Only the dev knows if that’s possible.

2 Likes