This post is a follow-up to a previous post entitled “Working with Names and Name Based Attributes” . In that post, I discussed various ways of generating unique values for attributes such as AccountName. Since that post, I have had customers with slightly different naming conventions ask about ways to do something similar, but to also include a numeric value. So, in this post, I’d like to provide you with one more method of generating a semi-random unique attribute value. Please note that, as before, I am using a custom activity (WAL) to generate a unique value in this workflow. WAL download and documentation can be found here . While the random number bit could be generated with a standard function evaluator and appended to the end of an AccountName, unfortunately, there is no way with that method to check for uniqueness. In some cases (where there may be a very small set of objects we need to generate this value for), this may be perfectly acceptable. For AccountName, however, I would much prefer to determine uniqueness, either against FIM or AD.
Let’s start by looking at the real meat and potatoes of the activity. Here are two different examples, showing we can make this either basic or slightly more complex.
Here we see FirstInitial + First 15 of LastName + RandomNumber
The reason behind trimming LastName to 15 it to give us a total length of 20 (hard limit in AD for sAMAccountName).
Here, we are doing essentially the same thing, only we are now trimming LastName to 14 and including a MiddleInitial, if present. If MiddleName is not present, we pass over it. This will, however, result in an overall length of 19 rather than 20.