Setup
...
Configure User Onboarding
Name Generator
10 min
introduction the activate name generator component allows you to generate and check for unique names using an easy, but sophisticated formatting mechanism the name generator has the following major features · remove invalid characters from the name depending upon the rules for the type of name being generated · check for uniqueness of the name and generate a unique name · format parts of the name into lower, upper and proper case · limit parts of the name and or the overall length of the name details the name generator has a special format the is used to generate the next name of the sequence and this is then used to check for uniqueness depending upon the type of name the name generator supports the following name types · login names · email addresses · common names (cn) each of these name types has different rules on what is considered unique and what characters are valid these are detailed below multiple formats can be separated by a ";" to provide a fallback incase the first method does not generate a unique name login names a login name is used for 'samaccountname' within active directory it can be used for any object type in active directory that has a samaccountname for example, users, groups and contacts the following characters are considered invalid in login names are automatically stripped " \\\\/\[] ;|=,+ ?<>@\\"'" for example, "my+name" would become "myname" login names are unique within a forest and therefore must be unique across the entire first the system checks this by querying the global catalogue ("gc ") email addresses email addresses are used to generate valid email addresses for exchange and can be used for any object that supports the proxyaddresses or mail attributes the format of email addresses is formally defined in rfc 5322 (mostly section 3 4 1) and by rfc 5321 the local part of the email address may use any of these ascii characters · uppercase and lowercase english letters (a–z, a–z) · digits 0 to 9 · characters ! # $ % & ' + / = ? ^ ` { | } · character (dot, period, full stop) provided that it is not the first or last character, and provided also that it does not appear two or more times consecutively (e g john doe\@example com) any invalid characters are stripped for example, " wendy(fred)@activatelive com" would become "wendyfred\@activatelive com" email addresses must be unique within the forest and this is checked by checking the 'proxyaddresses' attribute in the global catalogue common names (cn) a common name or cn is the name of an object in active directory this function can be used for any object type that is valid in active directory active directory allows all characters in common names however, some characters are reserved and must be escaped for example, ',' is a reserved character and must be escaped when being used within ldap it is recommended that these characters not be used in common names, however this is not enforced a cn must be unique within its container within active directory this generally means the organizationalunit (ou) that the object is going to be created in the name generate enforces this if an ou is specified valid characters by default any character that is valid for the specified name type is allowed this means that for example that ' is a valid character for email addresses there are times you wish to restrict these further a type modifier can be used to further restrict these these type modifiers can be combined to allow multiple classes of characters the valid modifiers are 'a' alpha characters only 'n' numeric characters only 'w' whitespace for example data/lastname\ a would allow alpha characters only in the last name for the user data/lastname\ anw would allow alpha, digits and whitespaces characters only in the last name for the user examples the following are examples of generating different types of names the following examples assumes the following data in the current arguments and job \<arguments> \<data> \<firstname>wendy\</firstname> \<initial>h\</initial> \<lastname>evans\</lastname> \</data> \</arguments> true 220,220,221 unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type note the '#' in the description means that a number should be added if there is a duplicate the following test script can be used to test and display the first 20 matches using system; using innovation activate; using innovation activate utilities; class script scriptbase { public void main() { string format = "data/firstname|data/lastname|{#}"; namegenerator g = new namegenerator(format, namegenerator validcharacters loginname); job j = new job(); j task = evaluator getobject("=//tasks/user/create user") as task; j arguments setvalue("data/firstname", "wendy"); j arguments setvalue("data/lastname", "evans"); j arguments setvalue("data/initial", "h"); j arguments setvalue("data/prefix", "ven"); for (int i = 0; i < 20; i++) trace writeline(g getnextusername(j, j arguments root)); } } appendix 1 formal grammar specification the following section outlines the formal grammar and specification for the name generator namepartexpr namepart \| namepart ; \[namepart] namepart " string " static \| { expr } format \| bindpath \| { # \[ startnumber] \[+] } \| { # \[ startnumber] \[+] } always force a number format "" \| \[type], \[maxlength] type l l lower case \| u u upper case \| p p upper case first char \| a a allow alpha characters only \| n n allow digits only \| w w allow whitespace maxlength integer