SailPoint doc doesn’t say that you should not make API calls
I haven’t come across any use case to make API calls, but I have read in community other developers implemented, however we can get confirmation on this.
Get all accounts, get uid of all accounts, feed them to a list, find the max number using Collections
