08/02/2023 07:51 AM
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.
08/02/2023 08:27 AM
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
08/02/2023 10:28 AM
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.
08/04/2023 03:06 AM
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
08/04/2023 03:23 AM
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
08/04/2023 12:05 PM
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.
08/06/2023 04:38 PM
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"))
08/06/2023 11:29 PM
users.entity is different and domain is different in our case.
Above syntax was just a example.
08/08/2023 03:27 AM
@rushikeshvartak please help as per my last note.
08/08/2023 07:17 AM
tried above and it is not working
08/09/2023 01:58 AM
we are waiting for your help and not getting any response. Kindly help, we are still waiting.