Email Generation Rules and Duplicacy Handling Across Six Domains

asharma
Regular Contributor II
Regular Contributor II

We possess six domains and aim to establish email generation rules for each of them. Additionally, we're verifying the existence of any duplicated users; in such cases, numerical digits will be appended to distinguish them. While we have successfully formulated the syntax for handling a duplicated user within one domain, we seek your guidance regarding extending this solution to cover duplicacy across all six domains. Specifically, we're seeking suggestions on how to effectively implement an 'else' condition for this scenario.

CASE
WHEN users.entity = 'ro' THEN CONCAT(users.firstname, '.', users.lastname, '@ro.com')
WHEN users.entity = 'HL' THEN CONCAT(users.firstname, '.', users.lastname, '@hi.com')
WHEN users.entity = 'dm' THEN CONCAT(users.firstname, '.', users.lastname, '@dm.net')
WHEN users.entity = 'co' THEN CONCAT(users.firstname, '.', users.lastname, '@co.com')
WHEN users.entity = 'ml' THEN CONCAT(users.firstname, '.', users.lastname, '@mi.com')
WHEN users.entity = 'mo' THEN CONCAT(users.firstname, '.', users.lastname, '@mo.com')
ELSE CONCAT(users.firstname, '.', users.lastname, IF(EXISTS(SELECT 1 FROM users u WHERE u.firstname = users.firstname AND u.lastname = users.lastname), '1', ''), '@hi.com')
END

The solution functions well for the 'hi.com' domain; now, we require the syntax to be adapted for all domains.

Please provide your assistance.

10 REPLIES 10

armaanzahir
Valued Contributor
Valued Contributor

Hi @asharma 

 

Can you try defining multiple rules for the same?

Something like:

CASE WHEN users.entity = 'ro' THEN CONCAT(users.firstname, '.', users.lastname, '@ro.com') WHEN users.entity = 'HL' THEN CONCAT(users.firstname, '.', users.lastname, '@hi.com') WHEN users.entity = 'dm' THEN CONCAT(users.firstname, '.', users.lastname, '@dm.net') WHEN users.entity = 'co' THEN CONCAT(users.firstname, '.', users.lastname, '@co.com') WHEN users.entity = 'ml' THEN CONCAT(users.firstname, '.', users.lastname, '@mi.com') WHEN users.entity = 'mo' THEN CONCAT(users.firstname, '.', users.lastname, '@mo.com') END#
CASE WHEN users.entity = 'ro' THEN CONCAT(users.firstname, '.', users.lastname, '1@ro.com') WHEN users.entity = 'HL' THEN CONCAT(users.firstname, '.', users.lastname, '1@hi.com') WHEN users.entity = 'dm' THEN CONCAT(users.firstname, '.', users.lastname, '1@dm.net') WHEN users.entity = 'co' THEN CONCAT(users.firstname, '.', users.lastname, '1@co.com') WHEN users.entity = 'ml' THEN CONCAT(users.firstname, '.', users.lastname, '1@mi.com') WHEN users.entity = 'mo' THEN CONCAT(users.firstname, '.', users.lastname, '1@mo.com') END#
CASE WHEN users.entity = 'ro' THEN CONCAT(users.firstname, '.', users.lastname, '2@ro.com') WHEN users.entity = 'HL' THEN CONCAT(users.firstname, '.', users.lastname, '2@hi.com') WHEN users.entity = 'dm' THEN CONCAT(users.firstname, '.', users.lastname, '2@dm.net') WHEN users.entity = 'co' THEN CONCAT(users.firstname, '.', users.lastname, '2@co.com') WHEN users.entity = 'ml' THEN CONCAT(users.firstname, '.', users.lastname, '2@mi.com') WHEN users.entity = 'mo' THEN CONCAT(users.firstname, '.', users.lastname, '2@mo.com') END#

If there is a duplicate found while evaluating rule 1 for any domain, it will go to rule 2 which would then be used to generate the new mail for the domain.

Thanks,

Armaan

Regards,
Md Armaan Zahir

asharma
Regular Contributor II
Regular Contributor II

Hi Armaan,

As per my understanding from above syntax is that it is not checking the condition if users email already exist with same name then how it will move to next rule.

Please suggest.

asharma
Regular Contributor II
Regular Contributor II

Hi @armaanzahir 

we tried the above rule but it only checks for 1st domain and creates the email for 1st domain only. Whenever we are trying to generate the email for other than 1st domain then also it is generating the email for 1st domain only.

Kindly suggest

 

armaanzahir
Valued Contributor
Valued Contributor

Hi @asharma ,

Assignment of the domain is based on the user's entity field right? if that is the case, then the case statements should take care of generating the domain based email address. 

Also, for uniqueness, this should work as if rule 1 is matching for a user that comes in as a duplicate, it would flow to rule 2. The uniqueness check is implicit and not something that you need to define in your query if you have multiple rules set up. you only need to specify multiple rules just in case rule 1 has a match and you want Saviynt to evaluate another rule in case of a match.

Configuring Identity Lifecycle Setup (saviyntcloud.com)

Let me know which case and for which user the generation rule is failing.

Thanks,

Armaan

Regards,
Md Armaan Zahir

asharma
Regular Contributor II
Regular Contributor II

Hi @armaanzahir  

Problem in existing case statement is that it is not flowing to rule no 2. It seems it is not validating with entity and creating the emails with rule 1 only.

Please suggest.

rushikeshvartak
All-Star
All-Star

Try below example 

if(users.entity ='ro',concat(users.firstname,".",users.lastname,"@",users.entity,".com"),concat(users.firstname,".",users.lastname,"@",users.entity,".com"))#if(users.entity ='ro',concat(users.firstname,".",users.lastname,"1@",users.entity,".com"),concat(users.firstname,".",users.lastname,"1@",users.entity,".com"))

Regards,
Rushikesh Vartak
If the response is helpful, please click Accept As Solution and kudos it.

asharma
Regular Contributor II
Regular Contributor II

Hi @rushikeshvartak 

users.entity is different and domain is different in our case. 

Above syntax was just a example.

asharma
Regular Contributor II
Regular Contributor II

@rushikeshvartak please help as per my last note.

asharma
Regular Contributor II
Regular Contributor II

 tried above and it is not working

asharma
Regular Contributor II
Regular Contributor II

we are waiting for your help and not getting any response. Kindly help, we are still waiting.