Saviynt unveils its cutting-edge Intelligence Suite products to revolutionize Identity Security!
Click HERE to see how Saviynt Intelligence is transforming the industry.
Saviynt Copilot Icon

Setting Primary SMTP in AD ExtensionAttribute2

asamaddar
New Contributor
New Contributor
Use Case:
We are in process to setting the Primary SMTP from Saviynt to AD, below are the action points that has been done:
  1. From Workday, we are getting a new attribute called 'Business_Units' that we are setting in Saviynt User Table under CP59
  2. In AD connection, we have updated Create AccountJSON and UpdateAccountJSON that if user.CP59 equals to any of the Business_Units attrbute (for eg. xyz) then set extensionAttribute2 as the SMTP (for eg. asamaddar@xyz.com)
Below are the action items that I would need help with:
While setting Create AccountJSON and UpdateAccountJSON, I am getting LDAP error code -21 : Error in attribute conversion operation, data 0, v4563
 
Code:
none of these are working:


'\"extensionAttribute2\" : \"user.firstname.toString().toLowerCase().replaceAll(',',' ')+'.'+user.lastname.toString().toLowerCase().replaceAll(',',' ')+'@xyz.com'\",'

or

'\"extensionAttribute2\" : \"user.firstname.toString().toLowerCase().replaceAll(\" \",\"\")+'.'+user.lastname.toString().toLowerCase().replaceAll(\" \",\"\")+'@xyz.com'\",'

or

'\"extensionAttribute2\" :'+user.firstname.toString().toLowerCase().replaceAll(" ","")+'.'+user.lastname.toString().toLowerCase().replaceAll(" ","")+'@xyz.com\",

6 REPLIES 6

pmahalle
All-Star
All-Star

Hi @asamaddar ,

Can you try below expression and check.

"extensionAttribute2" : "${user.firstname.toLowerCase().replaceAll(',',' ')+'.'+user.lastname.toString().toLowerCase().replaceAll(',',' ')+'@xyz.com'}"


Pandharinath Mahalle(Paddy)
If this reply helps your question, please consider selecting Accept As Solution and hit Kudos 🙂

Getting the below error:

Error while Update operation for account-costas in AD - Failed to parse template script (your template may contain an error or be trying to use expressions not currently supported): startup failed: SimpleTemplateScript2223.groovy: 43: expecting anything but ''\n''; got it anyway @ line 43, column 235. eAll(',',' ')+'@xyz.com'}\" ^ 1 error

@asamaddar Can you share your whole createaccountjson and updateaccountjson.


Pandharinath Mahalle(Paddy)
If this reply helps your question, please consider selecting Accept As Solution and hit Kudos 🙂

UPDATEACCOUNTJSON:

{
"jwsPersonID": "${user.customproperty15}",
"cn": "${user.customproperty25}",
"givenName": "${user.firstname}",
"sn": "${user.lastname}",
"middleName": "${user.middlename}",
"displayName": "${user.displayname}",
"street": "${user.street}",
"streetAddress": "${user.customproperty1}",
"l": "${user.city}",
"st": "${user.state}",
"postalCode": "${user.customproperty2}",
"co": "${user.country}",
"c": "${user.customproperty3}",
"company": "${user.companyname}",
"department": "${user.departmentname}",
"jwsDepartmentName": "${user.departmentname}",
"division": "${user.customproperty42}",
"employeeID": "${user.employeeid}",
"employeeNumber": "${user.employeeid}",
${if(user.statuskey==1)
'\"employeeType\": \"'+user.employeeType.toString()+'\",'
else
'\"employeeType\" : \"terminated\",'
}
"departmentNumber": "${user.departmentNumber}",
"jwsDivisionName": "${user.customproperty42}",
"jwsFunctionName": "${user.customproperty43}",
"jwsGroupName": "${user.customproperty44}",
"jwsHireDate": "${user.customproperty8}",
"jwsTermDate": "${user.customproperty21}",
"title": "${user.title}",
"jwsManager": "${user.customproperty9}",
"manager": "${user.customproperty9}",
${if(user?.customproperty5!=null &&user?.customproperty5.contains('Cross Knowledge'))
'\"proxyAddresses\" : [\"smtp:'+user.email+'\",\"SMTP:'+user.firstname.toString().toLowerCase()+'.'+user.lastname.toString().toLowerCase()+'@cxxxxxxxxxxxxx.com\",\"smtp:'+user.username+'@xxxx.mail.onmicrosoft.com\"],'
else if(user?.companyname!=null && user?.companyname.contains('Mxxxxx'))
'\"proxyAddresses\" : [\"smtp:'+user.email+'\",\"SMTP:'+user.firstname.toString().toLowerCase()+'.'+user.lastname.toString().toLowerCase()+'@mxxxx.com\",\"smtp:'+user.username+'@xxxxx.mail.onmicrosoft.com\"],'
else if(user?.companyname!=null && user?.companyname.contains('Hxxxxx xxxxxx'))
'\"proxyAddresses\" : [\"smtp:'+user.email+'\",\"SMTP:'+user.firstname.toString().toLowerCase()+'.'+user.lastname.toString().toLowerCase()+'@hxxxxx.com\",\"smtp:'+user.username+'@xxxxx.mail.onmicrosoft.com\"],'
else if(user?.email.contains('@wxxxxx.com'))
'\"proxyAddresses\" : [\"SMTP:'+user.email+'\",\"smtp:'+user.username+'@xxxxxx.mail.onmicrosoft.com\"],'
else
'\"proxyAddresses\" : [],'
}
"mail": "${user.email}",
"physicalDeliveryOfficeName": "${user.customproperty12}",
"roomNumber": "${user.customproperty13}",
"sAMAccountName": "${user.username}",
"uid": "${user.customproperty23}",
"extensionAttribute5":"${user.customproperty51}",
"userPrincipalName": "${user.customproperty24}",
"jwsTelephoneExtension": "${user.customproperty10}",
"tcUserID":"${user.customproperty29}",
${if(user?.customproperty59!=null && user?.customproperty59.contains('Axxxxx'))
"extensionAttribute2" : "${user.firstname.toLowerCase().replaceAll(',',' ')+'.'+user.lastname.toString().toLowerCase().replaceAll(',',' ')+'@axxxxx.com'}"
else
'\"extensionAttribute2\" : [],'
}
"moveUsertoOU": "${user.customproperty26}"
}

--------------------------------------------------
CREATEACCOUNTJSON
{
"objectClass": [
"top",
"person",
"organizationalPerson",
"user",
"jwsPerson",
"jwsObjectIdentifier"
],
"cn": "${user.customproperty25}",
"givenName": "${user.firstname}",
"sn": "${user.lastname}",
"middleName": "${user.middlename}",
"displayName": "${user.displayname}",
"street": "${user.street}",
"streetAddress": "${user.customproperty1}",
"l": "${user.city}",
"st": "${user.state}",
"postalCode": "${user.customproperty2}",
"co": "${user.country}",
"c": "${user.customproperty3}",
"company": "${user.companyname}",
"department": "${user.departmentname}",
"jwsDepartmentName": "${user.departmentname}",
"division": "${user.customproperty42}",
"employeeID": "${user.employeeid}",
"employeeNumber": "${user.employeeid}",
"employeeType": "${user.employeeType}",
"departmentNumber": "${user.departmentNumber}",
"jwsDivisionName": "${user.customproperty42}",
"jwsFunctionName": "${user.customproperty43}",
"jwsGroupName": "${user.customproperty44}",
"jwsHireDate": "${user.customproperty8}",
"jwsTermDate": "${user.customproperty21}",
"title": "${user.title}",
"jwsManager": "${user.customproperty9}",
"manager": "${user.customproperty9}",
"mail": "${user.email}",
"physicalDeliveryOfficeName": "${user.customproperty12}",
"roomNumber": "${user.customproperty13}",
"jwsObjectID": "${user.customproperty14}",
"jwsPersonID": "${user.customproperty15}",
"sAMAccountName": "${user.username}",
"uid": "${user.customproperty23}",
"userPrincipalName": "${user.customproperty24}",
"tcUserID": "${user.customproperty29}",
"userAccountControl": "512",
${if(user?.customproperty59!=null && user?.customproperty59.contains('Axxxxx'))
"extensionAttribute2" : "${user.firstname.toLowerCase().replaceAll(',',' ')+'.'+user.lastname.toString().toLowerCase().replaceAll(',',' ')+'@axxxxx.com'}"
else
'\"extensionAttribute2\" : [],'
}
"pwdLastSet": "0"
}

[This message has been edited by moderator to mask names]

Hi @asamaddar ,

Can you try with below CreateAccountJSON and UpdateAccountJSON and check. Syntax were wrong.

Create Account JSON:

{
"objectClass": [
"top",
"person",
"organizationalPerson",
"user",
"jwsPerson",
"jwsObjectIdentifier"
],
"cn": "${user.customproperty25}",
"givenName": "${user.firstname}",
"sn": "${user.lastname}",
"middleName": "${user.middlename}",
"displayName": "${user.displayname}",
"street": "${user.street}",
"streetAddress": "${user.customproperty1}",
"l": "${user.city}",
"st": "${user.state}",
"postalCode": "${user.customproperty2}",
"co": "${user.country}",
"c": "${user.customproperty3}",
"company": "${user.companyname}",
"department": "${user.departmentname}",
"jwsDepartmentName": "${user.departmentname}",
"division": "${user.customproperty42}",
"employeeID": "${user.employeeid}",
"employeeNumber": "${user.employeeid}",
"employeeType": "${user.employeeType}",
"departmentNumber": "${user.departmentNumber}",
"jwsDivisionName": "${user.customproperty42}",
"jwsFunctionName": "${user.customproperty43}",
"jwsGroupName": "${user.customproperty44}",
"jwsHireDate": "${user.customproperty8}",
"jwsTermDate": "${user.customproperty21}",
"title": "${user.title}",
"jwsManager": "${user.customproperty9}",
"manager": "${user.customproperty9}",
"mail": "${user.email}",
"physicalDeliveryOfficeName": "${user.customproperty12}",
"roomNumber": "${user.customproperty13}",
"jwsObjectID": "${user.customproperty14}",
"jwsPersonID": "${user.customproperty15}",
"sAMAccountName": "${user.username}",
"uid": "${user.customproperty23}",
"userPrincipalName": "${user.customproperty24}",
"tcUserID": "${user.customproperty29}",
"userAccountControl": "512",
"extensionAttribute2": "${if(user.customproperty59 != null && user.customproperty59.contains('Atypon')){user.firstname.toLowerCase().replaceAll(',',' ')+'.'+user.lastname.toString().toLowerCase().replaceAll(',',' ')+'@atypon.com'} else {}}",
"pwdLastSet": "0"
}

Update Account JSON:

{
"jwsPersonID": "${user.customproperty15}",
"cn": "${user.customproperty25}",
"givenName": "${user.firstname}",
"sn": "${user.lastname}",
"middleName": "${user.middlename}",
"displayName": "${user.displayname}",
"street": "${user.street}",
"streetAddress": "${user.customproperty1}",
"l": "${user.city}",
"st": "${user.state}",
"postalCode": "${user.customproperty2}",
"co": "${user.country}",
"c": "${user.customproperty3}",
"company": "${user.companyname}",
"department": "${user.departmentname}",
"jwsDepartmentName": "${user.departmentname}",
"division": "${user.customproperty42}",
"employeeID": "${user.employeeid}",
"employeeNumber": "${user.employeeid}",
${if(user.statuskey==1)
'\"employeeType\": \"'+user.employeeType.toString()+'\",'
else
'\"employeeType\" : \"terminated\",'
}
"departmentNumber": "${user.departmentNumber}",
"jwsDivisionName": "${user.customproperty42}",
"jwsFunctionName": "${user.customproperty43}",
"jwsGroupName": "${user.customproperty44}",
"jwsHireDate": "${user.customproperty8}",
"jwsTermDate": "${user.customproperty21}",
"title": "${user.title}",
"jwsManager": "${user.customproperty9}",
"manager": "${user.customproperty9}",
${if(user?.customproperty5!=null &&user?.customproperty5.contains('Cross Knowledge'))
'\"proxyAddresses\" : [\"smtp:'+user.email+'\",\"SMTP:'+user.firstname.toString().toLowerCase()+'.'+user.lastname.toString().toLowerCase()+'@crossknowledge.com\",\"smtp:'+user.username+'@wiley.mail.onmicrosoft.com\"],'
else if(user?.companyname!=null && user?.companyname.contains('Mthree'))
'\"proxyAddresses\" : [\"smtp:'+user.email+'\",\"SMTP:'+user.firstname.toString().toLowerCase()+'.'+user.lastname.toString().toLowerCase()+'@mthree.com\",\"smtp:'+user.username+'@wiley.mail.onmicrosoft.com\"],'
else if(user?.companyname!=null && user?.companyname.contains('Hindawi Romania'))
'\"proxyAddresses\" : [\"smtp:'+user.email+'\",\"SMTP:'+user.firstname.toString().toLowerCase()+'.'+user.lastname.toString().toLowerCase()+'@hindawi.com\",\"smtp:'+user.username+'@wiley.mail.onmicrosoft.com\"],'
else if(user?.email.contains('@wileyqa.com'))
'\"proxyAddresses\" : [\"SMTP:'+user.email+'\",\"smtp:'+user.username+'@wiley.mail.onmicrosoft.com\"],'
else
'\"proxyAddresses\" : [],'
}
"mail": "${user.email}",
"physicalDeliveryOfficeName": "${user.customproperty12}",
"roomNumber": "${user.customproperty13}",
"sAMAccountName": "${user.username}",
"uid": "${user.customproperty23}",
"extensionAttribute5":"${user.customproperty51}",
"userPrincipalName": "${user.customproperty24}",
"jwsTelephoneExtension": "${user.customproperty10}",
"tcUserID":"${user.customproperty29}",
"extensionAttribute2": "${if(user.customproperty59 != null && user.customproperty59.contains('Atypon')){user.firstname.toLowerCase().replaceAll(',',' ')+'.'+user.lastname.toString().toLowerCase().replaceAll(',',' ')+'@atypon.com'} else {}}",
"moveUsertoOU": "${user.customproperty26}"
}


Pandharinath Mahalle(Paddy)
If this reply helps your question, please consider selecting Accept As Solution and hit Kudos 🙂

With Update Account JSON I'm getting this  - Error while Update operation for account-costas in AD - [LDAP: error code 16 - 00000057: LdapErr: DSID-0C09105D, comment: Error in attribute conversion operation, data 0, v4563]