Iteration (AD target systems)
The Iteration
variable is available in Complex mappings. It is an integer that starts at 0 and counts how many times HelloID has run the JavaScript mapping function.
It becomes relevant when you're using the Uniqueness feature, and a complex target mapping generates a collision. When this happens, Iteration
is incremented and the complex mapping script is rerun.
To synchronize the iteration value across multiple fields, see Synchronize Unique Fields.
The maximum number of iterations (retries) per mapped field, per enforcement, is 50.
Typically, your JavaScript code in the complex mapping should convert Iteration
to a string and append it to the generated value (e.g., connie.van.den.winth
becomes connie.van.den.winth1
). For example:
function generateUserPrincipalName() { const domain = 'yourdomainhere'; const suffix = Iteration === 0 ? '' : Iteration; let firstName = Person.Name.NickName; let middleName = Person.Name.FamilyNamePrefix; let lastName = Person.Name.FamilyName; let userPrincipalName = firstName + '.'; //Check if the middleName variable contains data if (typeof middleName !== 'undefined' && middleName) { userPrincipalName = userPrincipalName + middleName.replace(/\s+/g, '.') + '.' } userPrincipalName = userPrincipalName + lastName; //Remove blank chars userPrincipalName = userPrincipalName.replace(/\s/g,''); //Convert to lower case userPrincipalName = userPrincipalName.toLowerCase(); //Remove diacritical chars userPrincipalName = deleteDiacriticalMarks(userPrincipalName); //Remove specific chars userPrincipalName = userPrincipalName.trim().replace(/[^0-9a-zA-Z.']/g, ''); userPrincipalName = userPrincipalName + suffix + '@' + domain; return userPrincipalName; } generateUserPrincipalName();