Iteration (Azure 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 is relevant when you're using either of the two Uniqueness features, and a complex target mapping generates a collision. When this happens, Iteration
is incremented and the script is rerun.
To synchronize Iteration
across all complex target mappings in a target system, enable Synchronize Unique Fields.
The maximum number of iterations (retries) per mapped field, per enforcement, is 99.
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 generateSamAccountName() { const suffix = Iteration === 0 ? '' : Iteration; let firstName = Person.Name.NickName; let middleName = Person.Name.FamilyNamePrefix; let lastName = Person.Name.FamilyName; let mailNickname = firstName + '.'; //Check if the middleName variable contains data if (typeof middleName !== 'undefined' && middleName) { mailNickname = mailNickname + middleName.replace(/\s+/g, '.') + '.' } mailNickname = mailNickname + lastName; //Remove blank chars mailNickname = mailNickname.replace(/\s/g,''); //Convert to lower case mailNickname = mailNickname.toLowerCase(); //Remove diacritical chars mailNickname = deleteDiacriticalMarks(mailNickname); mailNickname = mailNickname + suffix; return mailNickname; } generateSamAccountName();