I’m trying to get the number sequence tho work in cuba with no succes. I checked the forum and google but all the topics and solutions are to old. And the manual is’nt in my opinion very specific about this topic. My code is:
Mmm. I’ve used the UniqueNumberService in Kotlin and it seems to work fine, so I’m not sure why it doesn’t work in your case.
You haven’t said exactly what your’e seeing though. Looking at your code, it’s possible that the number is being generated, but the item property is not being set. I would start by assigning unService.getNextNumber to a variable and run it through the debugger to make sure that’s working.
private lateinit var uniqueNumbersService: UniqueNumbersService
val nextReferenceNumber = uniqueNumbersService.getNextNumber("MANUSCRIPT_REFERENCE")
That’s in Kotlin, but it should be fine in Java as it’s exactly the same code. I’ve tried it with the seed value you used and it works.
The only difference I can see is that you have called it directly inside a screen handler. Mine is called as part of a service. Could you try transferring the code into a service and seeing if that makes a difference?
The manual also mentions a different API, which you could also try, though I’m not sure that does anything different.