We are delighted to share our new EIC Delivery Methodology for efficiently managing Saviynt Implementations and delivering quick time to value. CLICK HERE.

Null check on part of string in ACCOUNTNAMERULE and CREATEACCOUNTJSON for AD connector

Diptansu11
New Contributor III
New Contributor III

Hello Team , 

I need some small suggestion , basically in our AD connector we have logic like below:

for creating sAMAccountName:

ACCOUNTNAMERULE
"sAMAccountName": "${user.customproperty20}${user.customproperty22}",

for creating DN:

CREATEACCOUNTJSON
${if(user.departmentname.equals('Claims'))
{'CN='+user.lastname+'\\, '+user.firstname+' '+user.customproperty22+',OU=Domain Users,DC=test,DC=co,DC=in'}

Now we are planning to implement this logic i.e. if cp22==null then sAMAccountname/CN=cp20 , else cp20+cp22 concatenated. 

For this i have written like below but seems i am missing some format please suggest:

UPDATED ACCOUNTNAMERULE:

"sAMAccountName": "${user.customproperty22==null?user.customproperty20:user.customproperty20user.customproperty22}"

UPDATED CREATEACCOUNTJSON:

${if(user.departmentname.equals('Claims'))
{'CN='+user.lastname+'\\, '+user.firstname+' '+{if(user.customproperty22==null){user.customproperty20}else {user.customproperty20user.customproperty22}}+',OU=Domain Users,DC=test,DC=co,DC=in'}

These are not working , i know its due to formatting or so , Please suggest.

Also when i want to write cp20and cp22 concatenated form inside else block ,do I need to use like 'cp20&cp22' or so ?

 

2 REPLIES 2

Manu269
All-Star
All-Star

@Diptansu11 can you refer a sample below :

${if(user.customproperty19 != null && user.customproperty19 != '' && (user.customproperty19 =='xx' || user.customproperty19 =='XXX' )) {if(user.customproperty7!=null && user.customproperty7!= '' && user.customproperty7.startsWith('ABCD')){if(user.lastname!=null && user.lastname != ''){'CN=ABCD.'+user.systemUserName.toUpperCase().charAt(0)+user.systemUserName.substring(1,user.systemUserName.indexOf('.'))+' '+user.systemUserName.toUpperCase().charAt(user.systemUserName.indexOf('.')+1)+user.systemUserName.substring(user.systemUserName.indexOf('.')+2)+',OU=Users,OU='+user.customproperty20+',OU=xx,DC=xx,DC=xx'} else{'CN=ABCD.'+user.systemUserName.toUpperCase().charAt(0)+user.systemUserName.substring(1,user.systemUserName.indexOf('.'))+user.systemUserName.substring(user.systemUserName.indexOf('.')+1)+',OU=Users,OU='+user.customproperty20+',OU=xx,DC=xx,DC=xx'}} else{if(user.lastname!=null && user.lastname != ''){'CN='+user.systemUserName.toUpperCase().charAt(0)+user.systemUserName.substring(1,user.systemUserName.indexOf('.'))+' '+user.systemUserName.toUpperCase().charAt(user.systemUserName.indexOf('.')+1)+user.systemUserName.substring(user.systemUserName.indexOf('.')+2)+',OU=Users,OU='+user.customproperty20+',OU=xx,DC=xx,DC=xx'} else{'CN='+user.systemUserName.toUpperCase().charAt(0)+user.systemUserName.substring(1,user.systemUserName.indexOf('.'))+user.systemUserName.substring(user.systemUserName.indexOf('.')+1)+',OU=Users,OU='+user.customproperty20+',OU=xx,DC=xx,DC=xx'}}}}

Regards
Manish Kumar
If the response answered your query, please Accept As Solution and Kudos
.

Hi @Diptansu11 

Could you please try with the below syntax.

${if(user.customproperty22==null)
{'CN='+user.customproperty20}
else{'CN='+user.customproperty20+user.customproperty22}

Also please refer the below post.

Solved: AD AccountNameRule using else - Saviynt Forums - 57443

Regards,

Dhruv Sharma