Announcing the Saviynt Knowledge Exchange unifying the Saviynt forums, documentation, training,
and more in a single search tool across platforms. Read the announcement here.

Email generation rule for duplicate email.

aminahasware
New Contributor III
New Contributor III

Hi,

We have requirement that some users have multiple first names or last names (i.e., Lara-Rodriguez, Pyaram-Shashidhar, Cotto-Sediles, etc).

In this case, the email generation rule should be as follows-

  • If the first name or last name contains a hyphen (- ) then use it as it is.
  • If the first name or last name contains space ( ) then replace it with an underscore (_).
  • If a duplicate email is found, autoincrement it with 1 starting with number 2.

 

i.e. – if Marina_Cotto-Sediles@domain.com  is found

then the new mail ID will be Marina_Cotto-Sediles2@domain.com 

 

We have used advanced config and used below query.

 

CONCAT(
        REPLACE(REPLACE(users.firstname, ' ', '_'), '''', ''),
        '_',
        REPLACE(REPLACE(users.lastname, ' ', '_'), '''', ''),
        '@domain.com'
    )

This query is working as expected but the problem is if a duplicate email ID is found then how to auto-increment in advanced config?

[This message has been edited by moderator to disable email hyperlink]

6 REPLIES 6

rushikeshvartak
All-Star
All-Star

Refer https://forums.saviynt.com/t5/saviynt-knowledge-base/achieve-email-uniqueness-check-during-email-gen...

https://forums.saviynt.com/t5/saviynt-knowledge-base/how-to-escaping-special-characters-in-user-attr... 

 

CONCAT( REPLACE(REPLACE(users.firstname, ' ', '_'), '''', ''), '_', REPLACE(REPLACE(users.lastname, ' ', '_'), '''', ''), '@domain.com' )#CONCAT( REPLACE(REPLACE(users.firstname, ' ', '_'), '''', ''), '_', REPLACE(REPLACE(users.lastname, ' ', '_'), '''', ''), '1@domain.com' )#CONCAT( REPLACE(REPLACE(users.firstname, ' ', '_'), '''', ''), '_', REPLACE(REPLACE(users.lastname, ' ', '_'), '''', ''), '2@domain.com' )


Regards,
Rushikesh Vartak
If you find this response useful, kindly consider selecting 'Accept As Solution' and clicking on the 'Kudos' button.

yatishtiwari
Regular Contributor
Regular Contributor

Thank you, @rushikeshvartak . It worked.


Please click the 'Accept As Solution' button on the reply (or replies) that best answered your original question.


Regards,
Rushikesh Vartak
If you find this response useful, kindly consider selecting 'Accept As Solution' and clicking on the 'Kudos' button.

Miko
New Contributor III
New Contributor III

If there are more email addresses in the sequence of 

Marina_Cotto-Sediles@domain.com

Marina_Cotto-Sediles1@domain.com

Marina_Cotto-Sediles2@domain.com

Marina_Cotto-Sediles3@domain.com

.....

how can we auto increment the index on advanced email generation rule?

Thanks,

Michael

...

In this case you need to maintain sequence manually in email generation rule.

 

CONCAT( REPLACE(REPLACE(users.firstname, ' ', '_'), '''', ''), '_', REPLACE(REPLACE(users.lastname, ' ', '_'), '''', ''), '@domain.com' )#CONCAT( REPLACE(REPLACE(users.firstname, ' ', '_'), '''', ''), '_', REPLACE(REPLACE(users.lastname, ' ', '_'), '''', ''), '1@domain.com' )#CONCAT( REPLACE(REPLACE(users.firstname, ' ', '_'), '''', ''), '_', REPLACE(REPLACE(users.lastname, ' ', '_'), '''', ''), '2@domain.com' )#CONCAT( REPLACE(REPLACE(users.firstname, ' ', '_'), '''', ''), '_', REPLACE(REPLACE(users.lastname, ' ', '_'), '''', ''), '3@domain.com' )#CONCAT( REPLACE(REPLACE(users.firstname, ' ', '_'), '''', ''), '_', REPLACE(REPLACE(users.lastname, ' ', '_'), '''', ''), '4@domain.com' )#CONCAT( REPLACE(REPLACE(users.firstname, ' ', '_'), '''', ''), '_', REPLACE(REPLACE(users.lastname, ' ', '_'), '''', ''), '5@domain.com' )#CONCAT( REPLACE(REPLACE(users.firstname, ' ', '_'), '''', ''), '_', REPLACE(REPLACE(users.lastname, ' ', '_'), '''', ''), '6@domain.com' )#CONCAT( REPLACE(REPLACE(users.firstname, ' ', '_'), '''', ''), '_', REPLACE(REPLACE(users.lastname, ' ', '_'), '''', ''), '7@domain.com' )#CONCAT( REPLACE(REPLACE(users.firstname, ' ', '_'), '''', ''), '_', REPLACE(REPLACE(users.lastname, ' ', '_'), '''', ''), '8@domain.com' )#CONCAT( REPLACE(REPLACE(users.firstname, ' ', '_'), '''', ''), '_', REPLACE(REPLACE(users.lastname, ' ', '_'), '''', ''), '9@domain.com' )#CONCAT( REPLACE(REPLACE(users.firstname, ' ', '_'), '''', ''), '_', REPLACE(REPLACE(users.lastname, ' ', '_'), '''', ''), '10@domain.com' )

Regards,
Rushikesh Vartak
If you find this response useful, kindly consider selecting 'Accept As Solution' and clicking on the 'Kudos' button.

yatishtiwari
Regular Contributor
Regular Contributor

Hi Michael,

below is the sample to achieve the same. 

Please note- using the rule you can not have a perpetual rule. like 1 to n. But you can have finite numbers like 1 to 10 or 15 based on what is suitable to you.

CONCAT( REPLACE(REPLACE(users.firstname, ' ', '_'), '''', ''), '_', REPLACE(REPLACE(users.lastname, ' ', '_'), '''', ''), '@domain.com' )#CONCAT( REPLACE(REPLACE(users.firstname, ' ', '_'), '''', ''), '_', REPLACE(REPLACE(users.lastname, ' ', '_'), '''', ''), '2@domain.com' )#CONCAT( REPLACE(REPLACE(users.firstname, ' ', '_'), '''', ''), '_', REPLACE(REPLACE(users.lastname, ' ', '_'), '''', ''), '3@domain.com' )#CONCAT( REPLACE(REPLACE(users.firstname, ' ', '_'), '''', ''), '_', REPLACE(REPLACE(users.lastname, ' ', '_'), '''', ''), '4@domain.com' )#CONCAT( REPLACE(REPLACE(users.firstname, ' ', '_'), '''', ''), '_', REPLACE(REPLACE(users.lastname, ' ', '_'), '''', ''), '5@domain.com' )