Hi! I am new to IDN, and I was told to generate an identity profile, on wich users’ login have the form sometext + sequence. For example, first user should be created as AAA00001, second as AAA00002, etc. How can I approach to develop this? Normally on an on premise solution I would store last number in some database or filesystem, but how can I save this last number on IDN? There is some possibility to store this on the VA filesystem? Or can perhaps make a trasform on which I read last created user, split its number and add 1 to it? Thank you for your recomendations!
Welcome to the developer community Julian.
Your use case sounds well suited for the username generator transform. This transform has a variable called uniqueCounter
that will handle the sequential generation at the end of your login string for you.
Hi Colin, thanks for response. As I saw from that link, the unique counter should arises where the username generated already exists, so for new users I will have an empty username right? For example, if I put as “AAA${uniqueCounter}” as patter, first username generated will be AAA, next AAA1 right?
Yes, I believe that is the behavior.
Yes, and I have also the challenge that sequence must be completed with zeros at the left to cover 4 digits, for example 0001, 0023, 0999… is some place where I could store the last number used? Other alternative is that I could read last created user, substring his username to obtain last number and plus it by 1. I am at my first project with IDN, I already did not know in detail this idm engine, I would be very helpful with some clue. Thanks!
Try combining left pad with the username generator. Set the padding to 0 and the length to 4. Although, it does get a little complicated. You might have to:
- Generate the username first
- use
split
orsubstring
transform to get the number on the end of the username - Apply the leftpad to the number
- Concat the number and username back together
Hi Colin, thank you very much for your help. I was trying with the generator, but it enconunter some problem. UniqueCounter’s values are between 1 and variable cloudMaxUniqueChecks, and although its value can be set at the beginning, it has a maximum allowed value of 50, so generator will always try numbers between 1 and 50. I think that this behaviour is though for usernames like firstname | lastname + some number, if user already exists. I am continuing researching.
You might have to create a custom rule to handle this logic.
Yes my friend, as far as I can read, I think that I am getting out of options with transforms. I found them very rich but this is a demand perhaps it can not attend. If I can reach this objective I will return to post it. Thanks!
Hi @jsosa, I have to perform the same as you with that format of username. Were you able to do it with a transform using the uniqueCounter or with a custom rule?, thanks in advance. Best Regards.