When running a sync workflow (e.g., Group Sync) configured to add a prefix (e.g., "XYZ_") to objects in the target Active Directory, the workflow fails with the following error:
Write: The distinguished name contains invalid syntax.
Error Message: Write: Directory Operation Error (InvalidDNSyntax): <:NUM:>: NameErr: DSID-03050F52, problem <:NUM:> (BAD_ATT_SYNTAX), data <:NUM:>, best match of: '<:DN:>'
Symptoms:
The cn, sAMAccountName, and displayName attributes are correctly mapped with the prefix in Advanced Mappings.
Standard syncs without renaming/prefixing work correctly.
The error occurs immediately when the workflow attempts to write the new object to the target.
The error occurs because of a logic mismatch in the Advanced Mappings.
While the mappings for the object names (CN, sAMAccountName) were updated to include the new prefix, the mapping for the distinguishedName attribute was not updated to reflect this change.
The system attempts to calculate the file path (the Distinguished Name) using the original source name, but the object itself is being created with the new, prefixed name. The Active Directory schema requires the Relative Distinguished Name (RDN) portion of the DN to match the CN of the object.
The issue can also be caused by source CN having an extra space characters.
To resolve this issue, you must ensure the distinguishedName attribute uses the exact same naming logic as the cn attribute.
Open your project and navigate to the Advanced Mappings configuration for the affected workflow.
Locate the mapping for the distinguishedName attribute.
Edit the mapping to wrap the prefix logic inside the GetDN() function.
Example Configuration: If you are adding the prefix "XYZ_" to your groups, change the distinguishedName mapping to:
GetDN(prefix(s.cn, "XYZ_"))
Save the mapping configuration.
Run the sync workflow again.
This configuration instructs the system to calculate the full directory path using the new name with the prefix included, satisfying the syntax requirements.
To address the extra space issue, please add trim() function to the DN mapping. For example:
GetDN(trim(cn))