Complex target mappings (AD target systems)
HelloID supports JavaScript for complex mappings. Use them to transform or format mapped user attributes using custom JavaScript code. Complex mappings support the ECMAScript 5.1 standard.
Use the Person
object to access fields in the current person. The properties of this object correspond to the fields in the Person schema. For example, a person's first name may be available at Person.Name.GivenName
. Do not attempt to initialize or overwrite these properties.
Use the Person.Accounts.
object to Use shared fields in AD via the Share account fields between target systems feature. For example, Person.Accounts.PowerShell.UserName
. Do not attempt to initialize or overwrite these properties.
Complex target mappings support several types of Uniqueness checks, using the Iteration variable.
The following script is an example of a complex target mapping.
// Please enter the mapping logic to generate the userPrincipalName. 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();