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

How to update proxyaddresses in AD using updateAccountJSON

amitasingh123
New Contributor III
New Contributor III

I need to update a user's proxy addresses based on certain conditions at the user level. However, when I tried to update the proxy addresses using the JSON structure below, the email addresses were mistakenly passed as a single string at first index of a list instead of a seperate element of a list.

"proxyaddresses": {"Replace":["${if((user.email.contains('xxxxx')||user.customproperty8.contains('yyyyy'))&& task?.accountKey.customproperty56.contains('SMTP:' + user.username + '@xyz.org')){'SMTP:' + user.email + ',' + task?.accountKey.customproperty56.replace('SMTP','smtp')} else {if((user.email.contains('xxxxx')||user.customproperty8.contains('yyyyy'))&& task?.accountKey.customproperty56.contains('SMTP:' + user.email))
{task?.accountKey.customproperty56}else {if(task?.accountKey.customproperty56.contains('SMTP:' + user.email))
{task?.accountKey.customproperty56} else{'SMTP:' + user.email + ',' + task?.accountKey.customproperty56.replace('SMTP','smtp')}}}}"]},

So basically proxy address should be like below:
{
"proxyAddresses": ["email1@example.com", "email2@example.com"]
}

but the above JSON passsing the value like below:
{
"proxyAddresses": ["email1@example.com,email2@example.com"]
}

3 REPLIES 3

vivek_kotagiri
Saviynt Employee
Saviynt Employee

What ever the address you forming at the end you have to do 

.toString().replaceAll(',','","') which will form the proxy address as required.
 
 
for Example:
 
"proxyAddresses":["SMTP:' + user.email.split('@')[0].replaceAll('_', '.') + '@abc.com","smtp:' + user.email.split('@')[0] + '@def.com","smtp:' + user.email + '","sip:' + user.email + '","smtp:' + user.email.split('@')[0] + '@abc.mail.onmicrosoft.com","smtp:' + user.email.split('@')[0] + '@def.com","smtp:' + user.email.split('@')[0] + '@abcde.com","smtp:' + task.accountName + '@def.com","' + user.customproperty65.replaceAll('SMTP', 'smtp').toString().replaceAll(',','","') + '"]
​Vivek Kotagiri​
​Technical Lead | ​Professional Services

Thanks, Vivek. I modified the JSON as below, and now it's working perfectly:

"proxyaddresses": {"Replace":["${if((user.email.contains('xxxxx')||user.customproperty8.contains('yyyyy'))&& task?.accountKey.customproperty56.contains('SMTP:' + user.username + '@xyz.org')){('SMTP:' + user.email + ',' + task?.accountKey.customproperty56.replace('SMTP','smtp')).replaceAll(',','","')} else {if((user.email.contains('xxxxx')||user.customproperty8.contains('yyyyy'))&& task?.accountKey.customproperty56.contains('SMTP:' + user.email).replaceAll(',','","'))
{task?.accountKey.customproperty56}else {if(task?.accountKey.customproperty56.contains('SMTP:' + user.email))
{task?.accountKey.customproperty56.replaceAll(',','","')} else{('SMTP:' + user.email + ',' + task?.accountKey.customproperty56.replace('SMTP','smtp')).replaceAll(',','","')}}}}"]}

Thank you , this works