Active Directory Agent Truncating Email to One Character
Last Updated:
Overview
In some Active Directory (AD) configurations, certain users may not have an email address. When another value, such as a name, is mapped to the email attribute, the value is truncated and only the first character is populated as the email address.
Applies To
-
Active Directory
-
Attribute Mappings
Cause
The issue is caused by incorrect logic in the attribute mapping expression. An expression formatted like the one below attempts to create an object for the email value, which results in the truncation.
emails: (raw_data.mail ? [{value: raw_data.mail }] : raw_data['userPrincipalName'])
Solution
Replace the existing mapping expression with the following code to correctly handle the email value as a string:
// Store the actual value of raw_data.mail as text string if found
var useremail = (raw_data.mail ? raw_data.mail : raw_data['userPrincipalName']);
profile['emails'] = [useremail]; // Initiate array of emails with useremail
profile['email'] = useremail; // Save useremail as email property