05/04/2023 10:16 PM - edited 05/05/2023 03:27 AM
Hi Team,
We have a requirement in which we need to generate unique email in the CheckForUnique Rule Check parameter of ADSI and we need to check for a few conditions before generating the email or appending the counter in case of duplicates found. We have referred the following forum posts ( How To - Achieve User / Account Name uniqueness ch... - Saviynt Forums - 28566 ) but unable to frame the syntax for checking conditions by using 'case when then' logic.
The requirement is - if the user is of type employee and is having desiredfirstname present , then it will generate the email as desiredfirstname.lastname@domain.com, or else firstname.lastname@domain.com
Please let us know if the below syntax is correct:
{
"email": "customproperty3",
"RuleCheck": case when (users.employeetype = "Employee" and users.preferedfirstname IS NOT NULL) then concat(lower(users.preferedfirstname),'.',lower(users.lastname),'@domain.com') end#case when (users.employeetype = "Employee" and users.preferedfirstname IS NOT NULL) then concat(lower(users.preferedfirstname),'.',lower(users.lastname),1,'@domain.com') end
}
05/05/2023 08:01 AM
Hi @sdey_2023
You need to pass the condition in the json format ( the above is you are using sql format ), Use it same like a rest connector ( if else condition for ur requirement and try it out )
Thanks
Darshan
06/13/2023 10:51 PM
@sdey_2023 Please try using this example for ADSI CHECKFORUNIQUE. Tweak this config according to your own logic.
{
"CheckForUnique": {
"Attributes": {
"email": "customproperty3",
"RuleCheck": "${if(user.employeeType=='Employee' && user.preferedFirstName !=null){return user.preferedFirstName+'.'+user.lastname+'@domain.com'}}###${if(user.employeeType=='Employee' && user.preferedFirstName !=null){return user.preferedFirstName+'.'+user.lastname+'1@domain.com'}}###${if(user.employeeType=='Employee' && user.preferedFirstName !=null){return user.preferedFirstName+'.'+user.lastname+'2@domain.com'}}"
}
}
}