Click HERE to see how Saviynt Intelligence is transforming the industry. |
01/11/2023 09:10 AM
We have a requirement for unique user CNs as accounts can change OUs based upon their relationship to the organization (temp, contractor, employee,...). How do we check for existing new user CNs in AD and append a numeric suffix if it already exists?
Thank you
01/11/2023 09:53 AM - edited 01/11/2023 09:54 AM
HECKFORUNIQUE | Specify this parameter if you want to evaluate the uniqueness of an attribute in the Active Directory domain before it is provisioned. The attribute is evaluated for all provisioning operations and the associated changes are made to it to make it unique. To use this parameter, specify the attributes that you want to check in Active Directory for the unique constraint of rules separated by ###. | Example: {
| - |
01/13/2023 02:33 PM
Thank you @rushikeshvartak.
This is still an issue. I updated CHECKFORUNIQUE to:
{"cn":"${user.firstname} ${user.lastname}###${user.firstname} ${user.lastname}1###${user.firstname} ${user.lastname}2###${user.firstname} ${user.lastname}3###
${user.firstname} ${user.lastname}4###${user.firstname} ${user.lastname}5###${user.firstname} ${user.lastname}6"}
Here's the ACCOUNTNAMERULE:
${if(user.employeeType == 'EMPLOYEE') {
'CN='+user.firstname+' '+user.lastname+',OU=Employees,OU=Test Users,OU=Users,DC=TEST,DC=NET'+'###'+
'CN='+user.firstname+' '+user.lastname+'2,OU=Employees,OU=Test Users,OU=Users,DC=TEST,DC=NET'+'###'+
'CN='+user.firstname+' '+user.lastname+'3,OU=Employees,OU=Test Users,OU=Users,DC=TEST,DC=NET'+'###'+
'CN='+user.firstname+' '+user.lastname+'4,OU=Employees,OU=Test Users,OU=Users,DC=TEST,DC=NET'+'###'+
'CN='+user.firstname+' '+user.lastname+'5,OU=Employees,OU=Test Users,OU=Users,DC=TEST,DC=NET'+'###'+
'CN='+user.firstname+' '+user.lastname+'6,OU=Employees,OU=Test Users,OU=Users,DC=TEST,DC=NET'
}
else {
'CN='+user.firstname+' '+user.lastname+',OU=Contractors,OU=Test Users,OU=Users,DC=TEST,DC=NET'+'###'+
'CN='+user.firstname+' '+user.lastname+'2,OU=Contractors,OU=Test Users,OU=Users,DC=TEST,DC=NET'+'###'+
'CN='+user.firstname+' '+user.lastname+'3,OU=Contractors,OU=Test Users,OU=Users,DC=TEST,DC=NET'+'###'+
'CN='+user.firstname+' '+user.lastname+'4,OU=Contractors,OU=Test Users,OU=Users,DC=TEST,DC=NET'+'###'+
'CN='+user.firstname+' '+user.lastname+'5,OU=Contractors,OU=Test Users,OU=Users,DC=TEST,DC=NET'+'###'+
'CN='+user.firstname+' '+user.lastname+'6,OU=Contractors,OU=Test Users,OU=Users,DC=TEST,DC=NET'
}}
CN 'Jack Sparrow' already exists in Employees OU
CN 'Jack Sparrow2' exists in Contractors OU
We're receiving this error trying to provision:
Checking DN for CN=Jack Sparrow,OU=Employees,OU=Test Users,OU=Users,DC=TEST,DC=NET.
Checking DN for CN=Jack Sparrow2,OU=Employees,OU=Test Users,OU=Users,DC=TEST,DC=NET.
Not FOund DN for CN=Jack Sparrow2,OU=Employees,OU=Test Users,OU=Users,DC=TEST,DC=NET.
Error while creating account in AD - CN=Jack Sparrow2,OU=Employees,OU=Test Users,OU=Users,DC=TEST,DC=NET:
[LDAP: error code 34 - 00002081: NameErr: DSID-03050F42, problem 2003 (BAD_ATT_SYNTAX), data 0, best match of:
'CN=Jack Sparrow2,OU=Employees,OU=Test Users,OU=Users,DC=TEST,DC=NET' ]
LDAP error aside, we still need to first check the CN for uniqueness and then append the appropriate OU.
I appreciate any help you can offer.
WEG